Drop down not keeping value after errors are shown

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?

have you tried logging the value of @my_obj.card_type to see what it
returns?

Mike

Mike G. wrote:

have you tried logging the value of @my_obj.card_type to see what it
returns?

Mike

that value gets sent over the wire correctly, but it doesn’t come back
up if the form had errors.

post your code