I’m developing project on rails 2.3.8 and I need to observe field on drop down menu which develop using collection select. Please can some one explain how to observe field ?
My collection select code is like this
<%= collection_select("event", "trainer_id", @trainers , :id, :name, {:prompt => true}) %>
And I don’t know how to use observe field for this. So please can some one explain about this ?
Related: Auto populate a text field based on another text field
Observes the field with the DOM ID specified by
field_idand calls a callback when its contents have changed. The default callback is an Ajax call. By default the value of the observed field is sent as a parameter with the Ajax call.Read this details: http://apidock.com/rails/ActionView/Helpers/PrototypeHelper/observe_field