javascript - Rails: How to send the contents of an <option> tag? -


i know when using rails there naming convention html forms allows input values automatically sent params controller upon form submit. example, when submit <input id="user_name" name="user[name]"/> controller, can capture value of input params[:user][:name].

i know if submit select tag such as:

<select name="user[car]">   <option value="1" selected>volvo</option>   <option value="2">saab</option>   <option value="3">mercedes</option>   <option value="4">audi</option> </select> 

i can capture value 1 params[:user][:car] in controller.

but can if have same select tag , want send both id of car and name of car? there way without creating text field receives car name on change event of select tag?


Comments