Skip to content

Adding onInlineError callback #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 9, 2015

Conversation

JoshKoberstein
Copy link
Contributor

I added a callback called onInlineError that is called in validateInputOnBlur function when validation fails so that DOM manipulation can occur on inline errors before the full form submit.

…s added so that form DOM manipulation can occur before full form submit.
victorjonsson added a commit that referenced this pull request Feb 9, 2015
Adding onInlineError callback
@victorjonsson victorjonsson merged commit c1da41a into victorjonsson:master Feb 9, 2015
victorjonsson added a commit that referenced this pull request Feb 9, 2015
@victorjonsson
Copy link
Owner

I will rename the callback to onBlurError. The keyword inline implies something about the position of the error message, in my opinion. Just because the validation is triggered by the onblur-event doesn't it necessarily mean that the error message will be displayed inline. You may have configured the error messages to be displayed somewhere else. Let me know if you can see any special reason for naming it to onInlineError that I may have overlooked.

victorjonsson added a commit that referenced this pull request Feb 9, 2015
@victorjonsson
Copy link
Owner

Okey... I now removed this callback. You should be able to use onElementValidate. There was a bug that made the callback only to fire when submitting the form but now it also fires onblur.

 $.validate({
    onElementValidate : function(valid, $el, $form, errorMess) {
      console.log('Input ' +$el.attr('name')+ ' is ' + ( valid ? 'VALID':'NOT VALID') );
    }
  });

But thanks anyway for investing time in trying to improve the plugin!

@JoshKoberstein
Copy link
Contributor Author

No problem, I am using it on a project and loving it. Your solution is even better 👍

However, I am now receiving js error on line 953:

 conf.onElementValidate((result === true), $elem, $form, validation);

@victorjonsson
Copy link
Owner

Could you please provide me with the full error message and possible stack trace?

@JoshKoberstein
Copy link
Contributor Author

Looks like I cannot reproduce this error now so it looks like you fixed it. Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants