On change of drop down showing a new textfield

hi,

i have a situation where i have a list of options from which a user
selects
his options if its not in the list he/she selects Others/Not Present and
a
new textfield should pop up and the data entered there should be
considered
instead of dropdown.

i have done this using javascript/dhtml but i was wondering how this can
be
done using pure rails i.e using some of the RoR apis?.

i would appreciate if anyone helps me with this.

warm regards
gaurav v bagga

Gaurav,

Observe field is really good for this. If you set an observe field on
your
select box, and leave out the frequency option it will perform the
action on
onchange. I think there is also an :on option that you can specify the
event.

It then becomes an rjs response (or inline render of the page object) to
supply the text box with value etc.

Hope this is what your after

Daniel,
thanks for your reply ,
but i have started RoR a week back and i am really new, what you said i
didn’t get,
well i will google around what you have said and try to find out the way

regards
gaurav

Something like this…

<%= observe_field(‘tournament_id’, :update => ‘event_select’, :url =>
{:action => ‘tournament_select’}) -%>

Then just be sure you have a tournament_select method in your controller
and that div will get updated with it’s content.

-philip