I am developing an app using Rails and jQuery. I would like to submit an id integer value via an input form but still display a friendly text value to the user while he is filling out the form. The text input field is using jQuery autocomplete so once the user chooses an entry, an integer value will be put into the input field. Is there any way to display a different value from what is actually submitted?
Alternatively, you can also keep a hidden input field, and use a "change" event to keep the hidden input field updated every time the user changes the original field.
Try using the combobox functionality for the jQuery UI Autocomplete:
http://jqueryui.com/demos/autocomplete/#combobox
The value attribute of the options are what get sent along with the form, not the display text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With