You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to run validations on a nested object?
For instance.
varpaymentInfo={creditCard: {number: 45343434343,expiration: '01/15'}};varvalidator=LGTM.validator().validates('creditCard.number').required('Credit card number is required').build();validator.validate(paymentInfo).then(function(){/*... */);
If not, is there a way to do something like this or do I have to build validations for each part separately and combine the results?
The text was updated successfully, but these errors were encountered:
Re the combining part -- something like this maybe would be a nice api?
varcreditCardValidator=LGTM.validator().validates('number').required('You must enter a card number').validates('expiration').required('Expiration is required').build();varpaymentInfoValidator=LGTM.validator().validates('creditCard').using(creditCardValidator).build();
How to merge the two results together would be an interesting challenge though.
pselden
changed the title
Validations on a nested object.
[Feature Request] Validations on a nested object.
Nov 20, 2014
This is an area LGTM could definitely improve. Most commonly at Square the problem that LGTM doesn't solve well is validating repeated child properties, i.e. children whose values are lists of things. How do you think you'd solve such a case?
Is it possible to run validations on a nested object?
For instance.
If not, is there a way to do something like this or do I have to build validations for each part separately and combine the results?
The text was updated successfully, but these errors were encountered: