Skip to content
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

first focus into an input,cannot validate #1624

Closed
tianleiwufeng opened this issue Oct 28, 2015 · 11 comments
Closed

first focus into an input,cannot validate #1624

tianleiwufeng opened this issue Oct 28, 2015 · 11 comments

Comments

@tianleiwufeng
Copy link

onfocusin: function( element ) {

i write 'this.lastElement = element;' in the fun

@staabm
Copy link
Member

staabm commented Oct 28, 2015

@xiongsisi please provide a jsfiddle which reproduces your issue. with this little information we cannot help you.

What do you do? What does the library do and what do you expect it should do?

@tianleiwufeng
Copy link
Author

i expect the library can validate when i first focus into one input .
second focus into the input

image
first focus into one input no validate

@tianleiwufeng
Copy link
Author

first picture is i second focus into the input,last one is the first focus.

@staabm
Copy link
Member

staabm commented Oct 28, 2015

by default a elements get validated when it loses focus. Therefore I think it doesnt work on the 2nd focus but on the first blur.

do you say, you want to start validation of the field on focus - even if the user did not start typing yet?

@tianleiwufeng
Copy link
Author

yes,that is what i mean

@tianleiwufeng
Copy link
Author

i think this is a bug,because i trigger onkeyup event,the library should start validation

@staabm
Copy link
Member

staabm commented Oct 28, 2015

@xiongsisi I dont think it makes sense to validate a field on 1st focus, but maybe it somehow makes sense in your app.

did you try invoking validator.element(...) in a focus event handler?

see http://jqueryvalidation.org/Validator.element/

@staabm
Copy link
Member

staabm commented Oct 28, 2015

i think this is a bug,because i trigger onkeyup event,the library should start validation

please provide a jsfiddle with steps to reproduce... you example shown above does not show that you invoke a keyevent somewhere.

@tianleiwufeng
Copy link
Author

as you say,i have to write validator.element as many as inputs length
and this is not what i want
i want to trigger the validation when i first focus on the input
what can i do but fix the library

@staabm
Copy link
Member

staabm commented Oct 28, 2015

as you say,i have to write validator.element as many as inputs length

what does that mean? do you intend to validate the whole form on first focus instead of one field?

i want to trigger the validation when i first focus on the input
what can i do but fix the library

with the information you provided I still dont see a bug in the library.

@staabm
Copy link
Member

staabm commented Feb 5, 2016

Closing because no repro jsfiddle availabe.
If you still experience the issue, please comment and provide a jsfiddle or other kind of simplied code sample to reproduce.

Thanks for the report.

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

No branches or pull requests

2 participants