elclanrs / jq-idealforms-old

The ultimate framework for building and validating responsive HTML5 forms.
665 stars 95 forks source link

return false ? #86

Closed obxpete closed 11 years ago

obxpete commented 11 years ago

I am using jQuery modal windows and I need to close the window programmatically. onSuccess almost gets me where I want to go, but I need the ability to return false (or similar) to cancel the form submission. Any thoughts? Thanks in advance,

elclanrs commented 11 years ago

I don't understand... Can't you use onFail? I mean, onSuccess only runs when all fields are valid otherwise onFail will run. See how it works

obxpete commented 11 years ago

right, no on fail does not work. I want the validation to run as normal, but then don't post the whole page back to the server.

In other words, if I could just put return false; in the onSuccess option then I'd be golden.

On Tue, Nov 27, 2012 at 3:23 PM, elclanrs notifications@github.com wrote:

I don't understand... Can't you use onFail? I mean, onSuccess only runs when all fields are valid otherwise onFail will run. See how it workshttps://github.com/elclanrs/jq-idealforms/blob/master/js/src/private.js#L56-L64

— Reply to this email directly or view it on GitHubhttps://github.com/elclanrs/jq-idealforms/issues/86#issuecomment-10775151.

Pete Lombardo obxpete@gmail.com

"Liberty without learning is always in peril; learning without liberty is always in vain."

elclanrs commented 11 years ago

Try:

onSuccess: function( evt ) {
  evt.preventDefault();
}
obxpete commented 11 years ago

Worked like a champ, thanks!

obxpete commented 11 years ago

Worked

On Tue, Nov 27, 2012 at 3:45 PM, elclanrs notifications@github.com wrote:

Try:

onSuccess: function( evt ) { evt.preventDefault(); }

— Reply to this email directly or view it on GitHub.

Pete Lombardo obxpete@gmail.com

"Liberty without learning is always in peril; learning without liberty is always in vain."