Ajax without submti button?

I have a drop down list, how can I set it up to send request when
selecting an option rather than pressing submit button after selection?

And how can I save values of checkboxex/radio buttons without submit?

Thanks

Just use add :onchange attribute to your select tag and put in a
remote_function to send your form via AJAX. You can use the prototype
function Form.serialize to send all the form elements.

See here for example:

http://onrails.org/articles/2006/05/01/remote_function-with

<%= select_tag “content_type”,
options_for_select(content_type_options),
{ :onchange =>
remote_function(
:url => {:action => ‘filter_by_content’},
:with => ‘Form.Element.serialize(this)’) } %>

Cheers
Luke

doesnt work for me

Vapor … wrote:

I have a drop down list, how can I set it up to
send request when selecting an option rather
than pressing submit button after selection?

And how can I save values of checkboxex/radio
buttons without submit?

I think observe_field may be what you’re looking for. Radio buttons may
be
problematic, but it works very well with check boxes, drop downs, and
other
form controls.

HTH,
Bill

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs