Skip to content

Instantly share code, notes, and snippets.

@jbueza
Created August 24, 2010 16:30
Show Gist options
  • Save jbueza/547842 to your computer and use it in GitHub Desktop.
Save jbueza/547842 to your computer and use it in GitHub Desktop.
//assign an observer to the submit button of the ajax form
this.addObserver("#btn-submit", "onclick", "Submit");
//only if we're passed validation, we show the overlay to display a request indicator
this.addObserver(this.getCommand("ValidateRules"), "onResponse", "ShowOverlay", { show: true });
//
this.addObserver(this.getCommand("Submit"), "onComplete", "ShowOverlay", { show: false });
//addintercepts
this.addIntercept("around", "Submit", "ValidateRules", {});
// command sequence:
// user clicks submit button -> validate the form -> if validation passes, show overlay -> hide overlay onComplete of submission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment