Ami wrote:
> an excellent tutorial by Ryan biggs: Updating a select box based on
> another
>
> http://frozenplague.net/?m=200805 pay attention the observe_field must
> have :update => the id on the page you want it to populate
> ;-)A
>
> On Oct 7, 8:21�pm, Jay Pangmi <[EMAIL PROTECTED]>
Thank for this info. I will be reading it hard but before that I got one
combo box update another combo using observe_field but only in Aptana
studio browser and when I tried in firefox I get this line with error
while loading the same page and doesn't work. Here's that line but
according to rails api doc I think it should create similar html tag
isn't it?:
<script type="text/javascript">
45//<![CDATA[
46new Form.Element.EventObserver('walks_id', function(element, value)
{new Ajax.Updater('campsites_list', '/user/update_campsites',
{asynchronous:true, evalScripts:true, parameters:'id=' + value +
'&authenticity_token=' +
encodeURIComponent('834004033f4404c8c5a6116d048eeab7e72d7c14')})})
47//]]>
48</script>
The code I'm using in the view that has observe_field is:
================================================================================
<%=javascript_include_tag "prototype"%>
<label for = "walk location">*Locations:</label><br />
<%= select(:walks, :id, Greatwalk.find_available_locations,
{:prompt=>'Select Great Walk Location'}, :selected => nil) %>
<%= observe_field("walks_id", :url => {:controller => "user", :action =>
"update_campsites"},
:update => "campsites_list", :with => "id")%>
<div>
<%=error_messages_for 'carts'%>
<%form_tag :action => :add_to_cart do%>
<table>
<tr>
<td>
<div id ="campsites_list" >
<label for = "camp location">*Campgrounds:</label><br />
<%= select_tag "campsite", %w{ ------- }, :class =>
"select_campsites" %>
</div>
</td>
....................
</tr>
<%=submit_tag "Add to cart"%>
</table>
<%end%>
================================================================================
Thanks..
--
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---