codebrew / backbone-rails

Easily use backbone.js with rails 3.1
MIT License
1.62k stars 255 forks source link

Select tag in place of an input tag breaks backbone_datalink #55

Closed wenzowski closed 12 years ago

wenzowski commented 12 years ago

First off, great gem! Thanks!

Normal input fields (as scaffolded) work beautifully:

<input type="text" name="color" id="color" value="green" >

But swapping the input field for a select breaks the link and the model stops being updated:

<select name="color" id="color">
  <option value="green">Green</option>
  <option value="blue">Blue</option>
</select>

As a newcomer to jQuery this seems odd since in the console $('#direction').val(); returns green || blue correctly.

wenzowski commented 12 years ago

total goof, not a bug.

If a default isn't set, by default no value is submitted.

<select name="color" id="color">
  <option selected value="green">Green</option>
  <option value="blue">Blue</option>
</select>