The dynamic toggle button is not working and has the value null saved.
When I select an asset type in AssetResource, the AssetTypeResource's associated schema is made available for filling out, with the exception of the toggle button. I have built an AssetTypeResource where I have established the schema for a certain asset type. When I first created an asset the toggle button field, stored the null value rather than the value true/false; yet, on the edit page, the value true/false is saved.
10 Replies
Sorry, what is the issue? Is your Toggle field saved as
null
instead of false
?yes
What if you activate the Toggle, does it save as
true
instead of null
?No
It's going to be hard to help you without more code and context... What have you tried?
?
I tried that as well, but it didn't work.
When I create something for the first time, this code continues to save the data as null.
I want to store the true/false value.
Have you tried a boolean cast, on the model?
Sorry, forget my code. I thought that you were trying to set false equal to null
This is the default behavior
This won't work any more because my_field is a column of the json type, and I want to store it in key-value format, as in
{"my_key": false}
.