Comments (7)
Ha! Just before I gave up, I tried one last thing:
The end function of the summary output mode first hides the container, then checks for buffer.length (which in my case was 0 for the last 2 validations, but even with a check for (buffer.length > 0) it triggered the code inside for the 0 length buffer (according to my console outputs).
So even, if there was no error it triggered $(container).show() - in my case an empty error container.
Now I've wrapped the display section:
if ($(container + " label").size() > 0) {
$(container).show();
}
and it finally works (I'm using s instead of
What I still don't understand is why the buffer might not be empty at the if, but is empty when it iterates to generate the error messages. Could this be a timing/parallelization problem? Because I trigger the validation too quickly the validations overlaps and I'm looking at the wrong buffer?
from validity.
Sorry about being so late to respond to this. Do you mean that 0 is evaluating as True? That seems very strange!
Perhaps it's related to the way your output is different. For example, in the normal summary output, it deletes all the <LI>
s, but you appear to be using <LABEL>
s. Maybe if you change...
// Hide the container and empty its summary.
$(container)
.hide()
.find("ul")
.html('');
...to...
// Hide the container and empty its summary.
$(container)
.hide()
.html('');
from validity.
Hi, I've tried that. It didn't work.
As I said, it only occurred when I've filled out a form with JS and had a change-event on each input/select, which triggered the entire form validation. So filling out triggered the validation very quickly say 10 times in a row.
I'll try to put together an example.
from validity.
Oh, I see what you mean! Yes, this is likely related to overlapping validation sessions. Maybe it would be different if, in your input change handler, you called end
just before you call start
again.
from validity.
You mean blocking the re-validation by some token until the previous validation is finished?
I put together this to demonstrate (I've copied my output method in there).
http://jsfiddle.net/NLZXM/3/
Click Submit to trigger the validation and then "fill out form" to populate values.
from validity.
Thanks for the example. That's very helpful! I think I've found the problem and I have a fix.
The issue is that the fadeIn
function uses an interval, so, sometimes, even though the div has been hidden, the interval to fade it in is still running!
We can fix this by changing line 35 of your JS code to...
$(container).stop().hide().html('');
Adding the call to stop
kills the interval for fading in.
This is definitely something that should be present in the normal summary output, so thanks a lot for this catch!
from validity.
Thanks a lot for your help! This finally solves my problem without any dirty code :)
And congrats to this great validation plugin. I've evaluated a couple of them and Validity turned out to be very lightweight and is still very powerful and flexible.
from validity.
Related Issues (20)
- CSS classes to invalid inputs HOT 2
- optional field with validation dilemma HOT 3
- Problem with input type="number" HOT 6
- Changing validation rules on the fly HOT 1
- Preventing multiple submits of the form HOT 2
- Guideline checkboxes HOT 5
- Not working with Safari? HOT 1
- checkbox validation HOT 1
- How to Disable the Validator HOT 1
- Scrollto doesn't work when in modal outputmode
- how to make radio button require HOT 1
- Add to Bower
- Append validations to existing validation
- Is it possible to change CSS so that label's arrow lines up with the bottom of the input field? HOT 1
- Add a package.json npm manifest to root
- hide() / show() changed in jquery 3 - breaks summary output HOT 1
- How to display message over a related element?
- jsfiddle example of using validity with tooltipster
- Documentation Site not working anymore HOT 1
- jquery 4 - Deprecated APIs removed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from validity.