-
Notifications
You must be signed in to change notification settings - Fork 58
Updated from 1.3.26 to 1.3.27 yesterday - tab out of required field leaves red border. #48
Comments
Documenting what I have learned so far. works fine in v1.3.26 shows problem in v1.3.27
click in type something tab out v1.3.26
all ok. on load v1.3.27
click in type something tab out v1.3.27 shows red border no error message
click in and click out again v1.3.27 now shows green
I still have not reproduced behaviour in a plunker which is getting frustrating. |
I doubt it would be the version 1.3.32, there is only some regular expression rule changes for accepting the '.' notation for all the date validators, it's mainly just changes in the I had similar problem to what you described, but I don't remember what it was since I fixed it (or I thought I did). It would really help to replicate the bug, so that I could investigate. You could try modifying the Plunker - Live demo that I have. I'm almost done with the I see you live in Brisbane, I went to Sydney last year to visit my best friend and I love it there, if only I could get the PR (seems hard though), I would move. Summer is too short in Canada haha. |
I updated my notes it wasn't 1.3.32 it was a red herring, it was the transition from 1.3.26 to 1.3.27 looks like. I have been trying to reproduce in plunker outside our environment no luck yet. I have another issue that has come up i need to spend the next hour or two on, and hope to get back t his again after that. |
There was a few changes in 1.3.27 as you can see by clicking on it. Inside the What I would ask you for helping to debug is to update to version 1.3.27 and from your index file, load these 4 source files. Then make sure you still get the problem and then, try overwriting the Would you have an onBlur function by any change on the same field? If you have an |
Canada nice place to visit, not sure I'd want to live there :). I have now tried with the 4 file version of 1.3.26 no problem. I have now tried 1.3.27 but with the directive from 1.3.26 and do not get the problem, so I do think your suspicion of onBlur seems the likely area. The field we have it on has not got any click or onblur functions. <input class="form-control margin-top-5" type="text"
ng-model="vm.username" placeholder="Username"
name="username" validation="required" id="username" debounce="10" /> |
Well at least we know which file it is, but without any ways of reproducing the error I can't really help you on my side. I can guide you but can't change the code myself. So you will have to debug it yourself with version 1.3.27 installed (including the Try debugging following these steps, test after each one, don't do them all in 1 shot else we can't find the problem 1- try removing the Also, do you have jQuery (which version)? and what browser do you test with? have you tried other browser? I usually test with Firefox/Chrome and sometimes IE |
Ok its Monday morning, I can’t reach work and the code remotely or I would have looked at this sooner. Occurs with following… Does not occur with IE11.0.9600 jQuery version is v2.1.4 Bit of extra learning, if I type characters and leave field quickly it does not happen, this is for both Chrome and Firefox version mentioned above. [works in ie] If I type some chars wait a while and leave field I get the red border. |
Moving the 1.3.27 blur handler out of attemptToValiate() causes the problem all the time leaving field – not a surprise at the moment. Putting the 1.3.26 blur handler into v1.3.27 outside attemptToValiate() calls $setValidity() not attemptToValidate() on next context after blur fixes the problem – not a surprise to me again as blue handler can only set validity nothing else then. Added the console.log() to 1.3.27, the event.target.value always seems to be set correctly. It appears the problem is triggered by leaving the field after the debounce delay that causes the red box it seems at the moment. As a hack in v1.3.35, I added a flag to validation-directive called ‘timerValidationSetValidation’ and set it to false initially, set it to true if the timer $setValidation call occurs, and then in the ‘blur’ handler specifically do nothing if set. This appears to address this issue – not surprising, however this is not a solution as it seems calling attemptToValidate() in the ‘blur’ is causing the wrong state to set if the timer had all ready called $setValidity(). I don't like this hack, so not going anywhere with it for now. Thanks for all your input so far, it has helped me learn more about not angular but also our current behaviour. Bit further hackery... Order of events. Ok as a test, I changed the called to attemptToValidate() to a delay of 10, and that fixes it so red box is not left behind in both Firefox and Chrome. |
Hello again, thanks for doing some troubleshooting :) Just a couple of things that I'd like to check with you... When you say you're getting the red border, you mean that the field is suppose to be invalid and you're not getting the error text, meaning you just get 1 of the 2, is that it? Or is it that it's suppose to be valid, but the red border stays? When you say adding a delay of 10, do you mean on this line At this point, I'm more interested into the delay of 10, could you give more details... Thanks a lot for all your help BTW, It's still Sunday night here in Montreal, Canada..hehe.. oh and I did and maintain this library on my personal time, though I started using it at work too, because well, it's too good..hehe |
I removed The field has validation set to required only. I load page, and click in it, field shows blue outline for focus. In v1.3.35 if i modify, the last parameter to attemptToValidate() to 10 my symptoms go away. elm.bind('blur', blurHandler = function(event) {
// get the form element custom object and use it after
var formElmObj = commonObj.getFormElementByName(ctrl.$name);
if (!formElmObj.isValidationCancelled) {
// validate without delay
attemptToValidate(event.target.value, 0); // <<<--- modify to 10
}else {
ctrl.$setValidity('validation', true);
}
}); In v1.3.35, in file validation-directive.js scope.$evalAsync(ctrl.$setValidity('validation', commonObj.validate(value, true) )); So far for me when i modifed the waitLimit to 10 in 'blur' handler it gives a bit of a delay before this last line is run, which means it gets to set the validity correctly. There is some sort of race condition here. |
Hmm ok I see, the problem in your case might be related to the Unless you find something else, I'm ok with adding the delay of 10 on line 74 (since it's 10ms, no one will ever see a difference anyway), I'll add not only in my Directive but also into my Service as well so they are exactly the same. BTW, you have 2 Bed time for me, I'll look at this tomorrow and push this fix and the ControllerAs, as long as it fixes all your problems. Again thanks a lot for the help, this is what I like about the community of open source :) |
Oops, yes to typo :) |
Added the delay of 10 in latest version, please test it and confirm. Thanks again for all the feedback :) |
Hey I answered you in the other issue #52 and might be the same answer for the problem you had here with the red border... You have to make your red border appear only after it's This is part of my CSS to do that, I always use the /* invalid & (dirty or touched) => red -- CSS3 only */
.ng-invalid.ng-dirty:not(:focus),
.ng-invalid.ng-touched:not(:focus) {
border-color: #e74c3c;
}
/* valid & dirty => green */
.ng-valid.ng-dirty.ng-touched {
border-color: #2ecc71;
} |
Just discovered this now.
Loaded our Sign in form, which has validation="required" for both username and password fields.
On page load, click in user name field type a value hit tab or click out of field the blue border turns red not green, as if it has an error but does not display the "Field is required." message. So it think its got an error but not the message. This occurs with 1.3.35, i just rolled back to 1.3.25 does not do it.
Appears to be a regression.
I have not created a working example yet, I hope to create a Plunker after I finish this other task.
On first form load, click in field type, form field goes green, tab out it is adding ng-invalid to classes and it goes red but no message, if i click in the form field again and then tab out again it clears it up and its fine and green. I am currently trying to reproduce in a plunker :) not having much luck yet.
The text was updated successfully, but these errors were encountered: