Beginner question about a combo box

Hi all

I want to translate this HTML code into a RoR code. The form is very
simple, it has a combo box, and when the user selects a value in the
list I would like to display a message that says, “You selected the
color X”

I know that I need a controller and a viewer. My question is about what
do I need to code the viewer to do somethin similar to this:

Select A Color From The List: Red Green Blue Pink Yellow

thanks

On 10/11/06, Jose P. [email protected] wrote:

<option value="Red">Red</option>
<option value="Green">Green</option>
<option value="Blue">Blue</option>
<option value="Pink">Pink</option>
<option value="Yellow">Yellow</option>

You can do something like this:

If you want to run some action on change, then write like this:
<select name=‘select’ onchange=’<%= remote_function :url => { :action =>
‘changed’ }, :with => “Form.Element.serialize(this)” %>’>

Maxim,

here is what I wrote in ROR and it works
html>

Combo Box!!! <%= start_form_tag :controller=>'color', :action=>'hi' %>

Select a color: <%=select_tag "textTag", options_for_select(%w{ Red Green Blue Pink Yelow }) %>

<%= @message %>

<%= submit_tag( "Submit") %>

<%= end_form_tag %>

thanks

Kulkin wrote:

On 10/11/06, Jose P. [email protected] wrote:

<option value="Red">Red</option>
<option value="Green">Green</option>
<option value="Blue">Blue</option>
<option value="Pink">Pink</option>
<option value="Yellow">Yellow</option>

You can do something like this:

If you want to run some action on change, then write like this:
<select name=‘select’ onchange=’<%= remote_function :url => { :action =>
‘changed’ }, :with => “Form.Element.serialize(this)” %>’>

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