Form with xhr and regular submits

Hey All,

I’m wondering if it’s possible to have a form with 2 submit buttons,
where one submit button whould submit the form via xhr and the other
would be a regular submit.

Possible? As simple as dynamically removing the ‘date-remote’
attribute from the form?

Thanks,

Curtis

On Nov 17, 2011, at 1:01 PM, Curtis Schiewek wrote:

Curtis

I don’t know how to do this in jQuery, but in Prototype it’s as easy as
this:

:onclick => ‘return this.up(‘form’).request();’

And you wouldn’t need to set data-remote on the form at all. The other
submit button would naturally just submit the form. If you wanted to get
the inline JavaScript out of your view, you would simply add an ID to
the submit button, and observe it from a dom:loaded listener:

$(‘my-groovy-button’).observe(‘click’,function(evt){
evt.stop();
this.up(‘form’).request();
});

HTH,

Walter