I replied to you with an example.
I wrote............ 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 Alex Mcauley http://www.thevacancymarket.com ----- Original Message ----- From: bill To: prototype-scriptaculous@googlegroups.com Sent: Thursday, August 20, 2009 4:28 PM Subject: [Proto-Scripty] Re: POSTing a form via AJAX bill wrote: 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 Putting the code as a script did not work, I expect, because the script was not served by Ajax.updater. Using Firebug I determined that the script was stripped out, which raises the next question. I know that I need to set a parameter to updater so that it will not strip scripts. I have read the section on evalScripts and the need to set the function with coolFunc = function () { ... } The script that loads the form is invoked as: new Ajax.Updater('showMessageDiv',url , {method: 'get',evalScripts: true} ); // get the requested message where url is defined as: url = 'mail/getmessage.php?n=' + message_id; but it does not upload the script so I suspect that I have the evalScripts in the wrong place. -- 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---