Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What would fire validations right away?
Message
 
 
To
All
General information
Forum:
Javascript
Category:
Other
Title:
What would fire validations right away?
Miscellaneous
Thread ID:
01638418
Message ID:
01638418
Views:
62
Hi everybody,

In many places in our application the required columns come up in red color even before anything was done with the input controls.

I don't understand what would cause the validations kick in right away? Is it a normal standard behavior or something is wrong?

Here is one sample of a form called using uibModal dialog. This is the markup of the control:
<div class="controls">
                                        <div class="col-lg-9">
                                            <input class="form-control"
                                                   ng-model="newPassword"
                                                   name="newPassword"
                                                   placeholder="@Labels.newPassword"
                                                   type="password"
                                                   autocomplete="off"
                                                   required
                                                   ng-pattern="validPassword" />  <!--/^\d*$/  This worked but not "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$" or "^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$"-->
                                            <!--I had to create validPassword ng scope function to make it work. Worked testing with http://www.regular-expressions.info/javascriptexample.html -->
                                            <div class="field-validation-error">
                                                <span ng-show="resetPasswordForm.newPassword.$error.pattern && resetPasswordForm.newPassword.$dirty">@Messages.passwordValidation</span>
                                                <span ng-show="resetPasswordForm.newPassword.$error.required && resetPasswordForm.newPassword.$dirty">@String.Format(Messages.isRequired, Labels.newPassword)</span>
                                            </div>
                                        </div>
                                    </div>
The password fields have red border when I just open the form (and did nothing yet). And when immediately as I start typing I get the pattern validation error.

I want to see the errors only after I leave the control, not while I'm typing or if I didn't even touch the control.

Do you know how can I figure out why this behavior is happening?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform