Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Field validation for the number type field
Message
 
 
À
Tous
Information générale
Forum:
Javascript
Catégorie:
Autre
Titre:
Field validation for the number type field
Divers
Thread ID:
01614770
Message ID:
01614770
Vues:
32
Hi everybody,

I have the following field
 <div class="form-group" ng-show="currentGuest.oNum2 !='' || currentGuest.number2!=0">
                <label class="control-label" title="@String.Format(Labels.userDefinedXY, Labels.number, "2")">{{currentGuest.oNum2}}</label>
                <input type="number" name="number2" id="number2" class="form-control" placeholder="@String.Format(Labels.numberX, "2")"
                       min="-2147483648" max="2147483647"
                       ng-model="currentGuest.number2" />
            </div>
            <div class="field-validation-error">
                <span ng-show="form.editGuestUserFields1Form.number2.$error.maxlength && form.editGuestUserFields1Form.number2.$dirty">
                    @String.Format(Messages.cannotExceed, String.Format(Labels.textX, "1"), 15)
                </span>
            </div>
I want to add validation for that field, but I can not figure out what should I use for min / max error. The current field validation is from the textbox and it works for ng-maxlength attribute. I want to figure out what to use for min or max attributes validation.

Thanks a lot in advance.

UPDATE. Looks like it should be $error.min and $error.max according to https://docs.angularjs.org/api/ng/input/input%5Bnumber%5D I'm testing these properties now.
If it's not broken, fix it until it is.


My Blog
Répondre
Fil
Voir

Click here to load this message in the networking platform