Observe_field and select lists

I’m somewhat confused on how to set up a select list for observe_field.
Example :

<%=options_from_collection_for_select @states, :id, :name %>

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

Stuart

On Oct 11, 2006, at 2:44 AM, Dark A. wrote:

then observe field on ‘someid’

-Ezra

So it looks like there is no <%= %> erb ? tags surrounding the select ?

Is that correct ?

Stuart

On 10/11/06, Ezra Z. [email protected] wrote:

then observe field on ‘someid’

-Ezra

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 Z. [email protected] wrote:

Stuart

fielkd has no dom id to observe. You don’t have to use helpers to

-Ezra

On Oct 11, 2006, at 11:01 AM, Dark A. wrote:

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})
})
//]]>

-Ezra