Adam Sosnowski wrote:> Hi,
>
> I''ve been trying to create a specific drop down list. The list,
apart
> from normal elements read from a database, should have additional
> element called ''Other.'' which when selected should cause
the drop down
> list to disappear and change to a standard text area in which the user
> can input whatever he wants.
>
> The first part is super simple. The ''select'' method makes
the drop down
> list
> flawlessly but I can''t figure out how to switch the drop down list
with
> a text area. I''m guessing you should use AJAX, but as my knowledge
of it
> is very low I was wondering if there is a substitute method that makes
> it possible (cause this idea seems pretty commonly used). If not, can
> someone point to the specific methods that can make this possible, or
> even better - a working example. Thanks :-)
1. Use
<option onclick="Element.update(''target-element-id'',
''HTML AS YOU
DESIRE'')">Other</option>
2. Use
<option onclick="<%= remote_function(:update =>
''div_id'', ..more
arguments..)%>">Other </option>
where the remote_function part is standard update-an-element with
server-generated code.
Sorry this is a bit scanty. If you provide more details maybe we can
fill in the missing pieces.
Stephan
--
Posted via ruby-forum.com.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---