This might be more of an HTML general question, but I have been trying
to find a "rails" way to do this and have come up short. What I want
to
do is to have a div appear if a certain selection from a drop-down is
selected or dissapeare if another option is selected. Here is what I
have:
<select id = "user_role" name = "user[role]">
<option value = "Admin" <%= @user.role ==
''Admin'' ? ''selected "selected"'' :
nil %>>Admin</option>
<option value = "Agency Admin" <%= @user.role ==
''Agency Admin'' ?
''selected = "selected"'' : nil %>
onselect = "alert(''TEST'');
document.getElementById(''agency_admin_div'').style.display
= '''';">
Agency Admin</option>
<option value = "Agent" <%= @user.role ==
''Agent'' ?
''selected = "selected"'' : nil
%>>Agent</option>
<option value = "Travel Manager" <%= @user.role ==
''Travel
Manager'' ? ''selected = "selected"'' :
nil %>>Travel Manager</option>
<option value = "Traveler" <%= @user.role ==
''Traveler'' ?
''selected = "selected"'' : nil
%>>Traveler</option>
</select>
This doesn''t work, and I have been unable to find an oppropriate rails
or html example that gives me what I want. I have done similar things
with rails helpers before but never with the "select" tag. Anybody
have
any suggestions? Thanks,
-S
--
Posted via http://www.ruby-forum.com/.