-
Notifications
You must be signed in to change notification settings - Fork 649
Should conditional type evaluation destroy data? #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes, this might be a good idea... It would make conditional even more useful. Maybe an option to turn it off if needed? |
I would suggest that the option allow for setting the value to a user preferred ( null, undefined, empty string or the current behaviour of do nothing) value, as in many cases it completely depends on how they then save the data to their database. |
Upon reflection I would like the default behaviour to set the value to null. It should not delete it as that is not ideal in JavaScript and the back end will need to be able to see changes without relying on every field always having a value. |
@Anthropic I took a stab at this feature in #371. I opted to use undefined instead of null, as that would most closely represent the state of how the user experienced the form (they don't see the question, so it never should come up in the model). However, I did include a check for a formDefaults definition of the destroyStrategy, which would allow for the entire form to use null as the mechanism for destroying data that has been hidden. |
@jbsaff great, I will keep an eye on it :) |
Completed by #371 |
I have an attribute directive I applied to my own decorator to remove data that was in elements hidden by a conditional type evaluation.
Should this perhaps be included in the main angular-schema-form behaviour?
Note: the oySchemaFormUtil is my own function that just manipulates data based on key, but unlike the built in one it also allows for total deletion which is why I use it instead. Not relevant to discuss in this post thread.
The text was updated successfully, but these errors were encountered: