json-schema-form/angular-schema-form-bootstrap

Form not validating correctly when model already has data

Opened this issue · 0 comments

Enhancement

As a user/developer, when I load a form where the model already has some fields filled in I should be able to see that those fields are invalid.

Expected behaviour

I expected the form to show an indication that the field was invalid.

Actual behaviour

It actually shows a green tick / indication that it is valid. Only upon changing a character, does it retrigger the form to show correct validation.

Gist/Plunker/Demo

This example has one field, which should be either the string "true" or "false". When the model / data has the field pre populated to something else, eg "bla", the form shows it as green / valid on initial page load.
https://plnkr.co/edit/8mVtMFv4UK7DT0VQztfY?p=preview

This plunker was forked from another so it may not be the absolute latest version, but I'm using the latest commit id from github and its reproducible locally.

Is this fixable with a form option or is it an actual bug?

Similarly when I enable validateOnRender in the form options, I was hoping that would also mark the field as invalid on initial load, when the model / data didn't have anything populated for that field, but it leaves it invalidated. I'm not sure if this is related or a separate ticket I should create. My intention that all fields explicitly show as red / green on initial page load, and my custom submit button is set to hide if the form is $invalid.

@json-schema-form/angular-schema-form-bootstrap-lead