I''m somewhat confused on how to set up a select list for observe_field. Example : <select name="search[state_id][]" size="10" multiple="multiple"> <%=options_from_collection_for_select @states, :id, :name %></select></fieldset> I want ot get the values when the user chooses them from the list. The "search[state_id] is not important as it''s from a regular search form. Just not sure how to name or id these lists so I can set up the observe_field. Does my question make sense ? Reading through some observe_field examples I''ve seen for a text_field it''s something like this : <%= text_field_tag("query", @params[''query''], :size => 10 ) %> Selects are the same ? (And yeah I should try it anyway before asking :) Stuart -- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ 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 http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On Oct 11, 2006, at 2:44 AM, Dark Ambient wrote:> <select name="search[state_id][]" size="10" multiple="multiple"><select name="search[state_id][]" size="10" multiple="multiple" id=''someid''> then observe field on ''someid'' -Ezra --~--~---------~--~----~------------~-------~--~----~ 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 http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
So it looks like there is no <%= %> erb ? tags surrounding the select ? Is that correct ? Stuart On 10/11/06, Ezra Zygmuntowicz <ezmobius-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > On Oct 11, 2006, at 2:44 AM, Dark Ambient wrote: > > > <select name="search[state_id][]" size="10" multiple="multiple"> > > <select name="search[state_id][]" size="10" multiple="multiple" > id=''someid''> > > > then observe field on ''someid'' > > > -Ezra > > > >-- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ 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 http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On Oct 11, 2006, at 11:01 AM, Dark Ambient wrote:> So it looks like there is no <%= %> erb ? tags surrounding the > select ? > > Is that correct ? > > Stuart > > On 10/11/06, Ezra Zygmuntowicz < ezmobius-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On Oct 11, 2006, at 2:44 AM, Dark Ambient wrote: > > > <select name="search[state_id][]" size="10" multiple="multiple"> > > <select name="search[state_id][]" size="10" multiple="multiple" > id=''someid''> > > > then observe field on ''someid'' > > > -Ezra >I''m not sure if we are talking about the same thing here. I was just saying that there is no id tag on your select tag so the observe fielkd has no dom id to observe. You don''t have to use helpers to make the select but you do need an id on the select tag. Here ia a working example that I am using. I like to write out the form observer JS by hand though as it is more flexible: <%= select_tag ''snapshot[version]'', options_for_select( @snapshot.versions.map{|v| v.version}, @selected_snapshot.version), :id => ''snapshot_select''%> <script type="text/javascript"> //<![CDATA[ new Form.Element.EventObserver("snapshot_select", function (element, value) { new Ajax.Request(''/apps/snapshot_version/<%= @app.id -%>'', {asynchronous:''true'', evalScripts:''true'', parameters:''version='' + value}) }) //]]> </script> -Ezra --~--~---------~--~----~------------~-------~--~----~ 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 http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
No we are talking about the same thing. Thanks for your help. Clears up at least one piece of the puzzle. Stuart On 10/11/06, Ezra Zygmuntowicz <ezmobius-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > On Oct 11, 2006, at 11:01 AM, Dark Ambient wrote: > > > So it looks like there is no <%= %> erb ? tags surrounding the > > select ? > > > > Is that correct ? > > > > Stuart > > > > On 10/11/06, Ezra Zygmuntowicz < ezmobius-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > On Oct 11, 2006, at 2:44 AM, Dark Ambient wrote: > > > > > <select name="search[state_id][]" size="10" multiple="multiple"> > > > > <select name="search[state_id][]" size="10" multiple="multiple" > > id=''someid''> > > > > > > then observe field on ''someid'' > > > > > > -Ezra > > > > > I''m not sure if we are talking about the same thing here. I was > just > saying that there is no id tag on your select tag so the observe > fielkd has no dom id to observe. You don''t have to use helpers to > make the select but you do need an id on the select tag. Here ia a > working example that I am using. I like to write out the form > observer JS by hand though as it is more flexible: > > <%= select_tag ''snapshot[version]'', > options_for_select( @snapshot.versions.map{|v| > v.version}, @selected_snapshot.version), > :id => ''snapshot_select''%> > > > <script type="text/javascript"> > //<![CDATA[ > new Form.Element.EventObserver("snapshot_select", function > (element, value) { > new Ajax.Request(''/apps/snapshot_version/<%= @app.id-%>'', > {asynchronous:''true'', evalScripts:''true'', parameters:''version='' + > value}) > }) > //]]> > </script> > > > -Ezra > > > > > >-- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ 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 http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---