This (if I haven't introduced any typos here) works fine, except that
the user-selection doesn't really populate the database's vendors
column in the expense record.
How do I repair this situation? I'd like to restore the the original
text field and somehow populate it with the user-selected value from
the select control.
This (if I haven't introduced any typos here) works fine, except that
the user-selection doesn't really populate the database's vendors
column in the expense record.
How do I repair this situation? I'd like to restore the the original
text field and somehow populate it with the user-selected value from
the select control.
Hi,
try this <%= select_tag "expense_vendor",
options_for_select(@current_vendors) %>.
PRiyanka and sameera: Thank you both very much!!! I've been pulling
my hair out for about a week with this thing.
I didn't realize that the first argument of the select_tag function
apparently identifies the target
of the selected item in the format "table_name[column_name]".
Now that you've given me this solution, I have to try to implement
what seems to me to by the more proper architecture for the Expense/
Vendor relationship, namely have the drop-down populate a hidden text
field (representing a expense-table column "vendor_id") and have the
vendor name displayed in the expense page but be merely non-editable
data not stored in the database. Probably a "has" clause would come
into play here.
I'm going to take a stab at this, run into a blank wall again, and
finally post a more thoughtfully worded question.
PRiyanka and sameera: Thank you both very much!!! I've been pulling
my hair out for about a week with this thing.
I didn't realize that the first argument of the select_tag function
apparently identifies the target
of the selected item in the format "table_name[column_name]".
you could have dodged that if you'd gone with f.select :vendor,
choices
The second parameter to f.select has the same requirements as what you
give to options_for_select
It's just a drop down box - it's not going to do anything to any other
control on the page - just pointing out that you don't need to use
select_tag when you have a form builder handing around.