Bill ....
You need to observe the form submit.
$('the-id-of-the-form').observe('submit',function(event) {
/// do the ajax that TJ said...
Event.stop(event); // will stop it doing its default action!
});
Alex Mcauley
http://www.thevacancymarket.com
----- Original Message -----
From: bill
To: [email protected]
Sent: Thursday, August 20, 2009 4:14 PM
Subject: [Proto-Scripty] Re: POSTing a form via AJAX
T.J. Crowder wrote:
Hi,
'Tis indeed very easy. Say you have a form wrapped in a div:
<div id='formwrapper'><form>
....
</form></div>
You can post it like so and take the result (which is presumed to be
an HTML snippet in this case) and use that to update the container:
new Ajax.Updater('formwrapper', someurl, {
parameters: $('formwrapper').down('form').serialize(true),
onFailure: function(response) {
// ...show a failure message...
}
});
...
That seemed so easy when I read the post, but. . .
How do I trigger the submission ?
I tried onsubmit = {the code above} and it just submitted regularly and
replaced the whole page with the output, not just the div.
I tried putting the code above as a script after the form, but still in the
div and got the same result.
bill
--
Bill Drescher
william {at} TechServSys {dot} com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---