Howard -

Thanks - that's a start. Unfortunately I need(ed) a way to stop the form submission. I'm executing code that has a callback to tell me it's done.


$('form').observe("form:prepareforsubmit", function(event) {

         if(!callbackExecuted){
            event.stop(); //this won't stop the form submitting
executeCodeThatCallsBack(); // the callback is meant to re-submit the form }

});


However, I am able to override the initialize method of  Tapestry.FormEvent

Tapestry.onDOMLoaded(function() {

   Tapestry.FormEvent.prototype.initialize =  function(form)
   {
       this.form = $(form);
       this.result = true;
       this.firstError = true;
       this.form.formEvent = this; // THIS IS THE CHANGE
   };


    $('form').observe("form:prepareforsubmit", function(event) {

        var form = event.target;

        var formEvent = form.formEvent;


formEvent.result = false; // THIS BOOLEAN CONTROLS WHETHER OR NOT THE FORM SUBMITS

    });

});


I'd rather not have to override that constructor (for obvious reasons). I'm in no way a javascript guru so maybe there would be a cleverer way of doing this. If you're still hammering out the Javascript API, please take this into consideration.

Keep up the good work!

-mike


Howard Lewis Ship wrote:
In 5.0.11-SNAPSHOT you can observe the "form:prepareforsubmit" event
on the Form object.

By observe, I mean all the Protoype stuff:

$(form).observe("form:prepareforsubmit", function() { ... });

On Tue, Feb 26, 2008 at 10:45 AM, Michael Lake <[EMAIL PROTECTED]> wrote:
 I've got some javascript that I want to execute AFTER the client-side
 validation has passed but BEFORE the actual form submission.

 I've tested out adding my own Tapestry.Validator so that  I could simply
 have a hidden form element that executes last(being placed before the
 </t:form> tag), but I have no idea where to poll to see whether all
 prior validations passed already.

 Can someone give me an idea for how to handle this?

 thanks,
 mike lake





 ---------------------------------------------------------------------
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to