Open AviFix opened 3 years ago
That is true, but how could it be handled otherwise and maintain the required validation?
What do you mean? Does it contradict?
Partially it does, because required
wouldn't trigger if field is empty, only triggers if field is not present.
Isn't it possible to trigger the required if the field is empty like the angular form control does?
ngx-schema-form doesn't rely on angular form control validation rather on a json schema validator. The default validator implementation is Z-Schema. JSON Schema validation counts an empty property as present and therefore the required rule is passed as 'valid'. A 'required' validation is negative only if the required property is not present at all.
Thanks for the detailed explanation.
Could you please point me to the code that is in charge of removing the empty fields and to the validation part?
I don't know it myself.
For preventing a huge breaking change this should end in a feature that can optionally be activated.
Maybe via forRoot(...)
or smt else
Sure
Anyone else that can point me toi the code that is in charge of removing the empty fields and to the validation?
@AviFix I would guess that widget.ts
could be a good start (just guessing)
Hi,
When leaving a field empty, its property seems to be removed from the form value.
Regular angular form: firstName is empty but is exist
ngx-schema-form:
email is empty and not showing in the model object.
Thanks