Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Simple way to treat 0 as wrong value?
Message
De
14/10/2016 09:54:59
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01641904
Message ID:
01641958
Vues:
24
>>>Hi everybody,
>>>
>>>I have the following drop down
>>>
>>>
>>><select class="form-control-inline"
>>>                        ng-model="currentMatrixTemplate.rowAttributeId"
>>>                        required
>>>                        ng-change="changeAttribute('row', currentMatrixTemplate.rowAttributeId, {{currentMatrixTemplate.rowAttributeId}})"
>>>                        ng-options="attribute.value as attribute.text for attribute in metaData.attributes |filter: { value: '!' + currentMatrixTemplate.columnAttributeId }">
>>>                    <option value="" disabled>        @String.Format(Labels.selectX, Labels.attribute)...</option>
>>>                </select>
>>>
>>>I want to make sure that user selected a value which will be a number greater than 0. I don't want the Add button to become enabled until it's done.
>>>
>>>I can, of course, make all the necessary checks in the Add button's code, but wondering if it somehow possible to treat 0 as 'empty' for required?
>>>
>>>
>>>Thanks in advance.
>>
>>Not sure I understand but why not filter out the '0' option from the ng-options in the first place ? Failing that then you could use a custom validator,
>
>There is no 0 option in the list. However, when the form starts in the new mode, the initial values are 0. I think that problem is not too important, I'll just add a check in the Add method.

You could set the ng-model field to a default initial value.....
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform