Found a solution!
In the DOM ready code, use the following instead of an Event.observe()
$('frm').onsubmit = handler;
The function (handler) still has access to the event which is nice.
BUT...
There is another problem, I'm using Ajax.Request as I want to do
specific things with the data returned and when I submit the form to
the server (using Ajax only) the first time it works great. But if I
then submit the form again (with no full page refresh in between) it
doesn't work.
It's almost like the DOM ready code can't see the form anymore. Is
there a way to re-initialise the Prototype code when you come back
from an Ajax call or something?
On Jan 23, 4:10 pm, Michael Sharman <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I want to submit a form via Ajax but have the form degrade to a
> standard (full page) submission when users don't have javascript. I'd
> like my markup to be clean, so I'd rather not have any onsubmit="" in
> my <form> tag.
>
> Currently I have an Event.observe('myForm', 'submit', handler), but in
> my function (handler) I can't stop the form from doing a full page
> submission.
>
> I've tried Event.stop(event); but that doesn't work.
>
> I'm using Prototype 1.6
>
> Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" 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-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---