How do you attach an event listener to watch for the user to change the
selected option in a ‘select’ field before they click the submit button
in order to instruct the page to change (AJAX) based on what the user
selected in the field. In other words, I want the page to be able
to change when the user makes a selection from a form select before they
ever click any button.
How do you attach an event listener to watch for the user to change the
selected option in a ‘select’ field before they click the submit button
in order to instruct the page to change (AJAX) based on what the user
selected in the field. In other words, I want the page to be able
to change when the user makes a selection from a form select before they
ever click any button.
Check out the observe_field method in
ActionView::Helpers::PrototypeHelper
In: vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb