My drop down gets reset to the first value when the form gets returned
with errors.
here is my code:
<%= f.select :card_type, [
[‘Choose a Payment Type’, nil],
[‘Visa’, ‘Visa’],
[‘MasterCard’, ‘master’],
[‘American Express’, ‘American Express’]] %>
For example, say the user selects “Visa” and doesn’t fill out the rest
of the form correctly. The user submits the form and errors are shown.
For some reason this drop down does not keep the “Visa” value and goes
back to the “Choose a Payment Type”.
How can i keep the value in the drop down after errors are shown?