Tz Le wrote:
> bill walton wrote:
>> Hi Tz Le,
>> On Tue, 2009-08-25 at 21:48 +0200, Tz Le wrote:
>>> Now when they change and the id is now 5
>>> If its not 5
>>> I want
>>>  <p>
>>>     <%= f.label :value %><br />
>>>     <%= f.text_field :value %>
>>> 
>>> Please if you can tell me how to access the first select- do I set an
>>> id? and what I do onchange since its in the same form a few lines down I
>>> want to have a different field.
>> 
>> You need to put an observe_field on the first field that makes an ajax
>> call to render a partial containing the second field with the
>> appropriate choices based on the first selection.  Try a google search
>> on 'rails observe_field select'.
>> 
>> HTH,
>> 
>> Bill
> 
> 
> 
> Ok.Thank you, I will search for this.

I read about the observe field select.
Two things: Every post I see determines a second select based on the 
first select. What I am trying to do is based on the first select either 
display a second select or display a text field(this will depend on the 
first select value)

I tried  to use the observe field and I am not sure of two things:
the action=> 'funtion'
Do I need to create in the controller any function and if yes what? 
basically if there is a change in the select,
I want to check the value if it equals 5,
display a second select,
 if not display text field.

Also what does the parameter :with do?
The :update=> "myfield name" this field should be the second select name 
and then how to I display the text field instead?

-- 
Posted via http://www.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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to