[Rails] Ajax and onsubmit

Al new at new.com
Wed Jul 26 18:27:28 GMT 2006


I've worked through the depot app and would like to use the ajax submit 
ability, but call it from a textbox's onblur event.  By using onblur I 
can submit the form, but the 'onsubmit' part isn't fired.

Is there a way to either fire the onsubmit event, or to copy that code 
into a text_field?  I tried a direct copy from the source of the form 
just to test it out without success.

the following didn't work for item 4:
%= text_field 'item', 'name', :size => 3, :value => item.name,
        :onblur=> "new Ajax.Request('/store/add_to_cart/4', 
{asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); 
return false;" %>

Anyone have experience with this?

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list