adamwathan / form

Super basic form HTML builder, only really exists so I can pull it in for some other more useful projects.
MIT License
232 stars 118 forks source link

Dev #1

Closed paul-crashley closed 10 years ago

paul-crashley commented 10 years ago

Updated the renderOptionsWithoutValues method as it was sending $label twice to the renderOption method

adamwathan commented 10 years ago

This is actually intended, it's designed so that if you pass an array of values without keys, it uses the value in the array for both the value and label in the options list:

$select = new Select('birth_year', array(1990, 1991, 1992));

// Should produce this...
<select name="birth_year">
  <option value="1990">1990</option>
  <option value="1991">1991</option>
  <option value="1992">1992</option>
</select>

// Pull request will give this...
<select name="birth_year">
  <option value="0">1990</option>
  <option value="1">1991</option>
  <option value="2">1992</option>
</select>

Thanks though! If you are seeing some unexpected behavior let me know and we'll figure it out.

paul-crashley commented 10 years ago

OK, I was passing an array with keys though, and still got the array values as the option values, instead of the array keys.

adamwathan commented 10 years ago

Can you paste a code sample? Would like to fix it for sure if it's a bug!