Drop down list with AJAX(?)

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 :slight_smile:

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 :slight_smile:

  1. Use
Other
  1. Use
Other

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs