On Nov 17, 2011, at 1:01 PM, Curtis Schiewek wrote:
> 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
>
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
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.