RXNT / react-jsonschema-form-conditionals

react-jsonschema-form-conditionals

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails to run rules if initial form data is undefined

Steffan-Ennis opened this issue · comments

I have the same issue.

@Steffan-Ennis @deepan-itela Are you on the latest version?

https://github.com/RxNT/react-jsonschema-form-conditionals/blob/61b08b8c4de59789259192b97115d047b12bed88/src/rulesRunner.js#L44-L46

There is a check in rulesRunner, that ignores undefined and null formData.
I'll add this anyway, just curious, how to reproduce this

I am using version 0.0.3. I think it will be helpful to you if I explain the exact issue. I want to show the password field only after the user enter something to username field. I have defined a remove rule if username is empty. But when the form renders it shows both username and password fields, if I type something in the username field and then clear it, the password field disappears. But it's not happening initially when the form is fresh (not dirty). When the form initially loads also the username field is empty, so theoretically it should hide the password field. But it only happens after I type something for username and erase it completely.

Note: I am not passing formData to the form.

@deepan-itela Can you switch to the latest version of conditional project, to verify this is still happening?