Open rajeshps opened 7 years ago
Hi, old issue, and most probably the problem is no longer relevant for you 2 years later, but for others that like me pull their hair at this...
I found this topic over here: https://github.com/gcanti/tcomb/issues/168
And it turns out that one can pass a default props to a struct. If you provide your values for the struct props there, then if the fields are missing in the template tcomb won't complain.
@gcanti - I think this can be closed.
Version
Tell us which versions you are using:
Expected behaviour
Tell us what should happen
When any given field is marked mandatory/required but not rendered and if valid VALUE exist in context then there shouldn't be a validation error.
Actual behaviour
Tell us what happens instead
In the above simple Form of 3 fields, all are
required
fields. However, via templates when one of the fields are not rendered for given condition (let's say if true don't renderLastName
) and form only has the Checkbox and FirstName. Whenrefs.form.validate()
is triggered I get below error despite myvalue
object having LastName value.No Error when
LastName
is made optional byt.maybe()
Also, No Error when
LastName
is displayed in form and obviously the value is populated to the field and validation passes through.Steps to reproduce
Stack trace and console log
Thanks