Is it somehow possible to set the select value to null if not visible
I am trying to set the select value to null if the field is not visible in the form. What I have so far.
I don't know how to make that work. Someone has an idea?
6 Replies
Try setting default value when it is visible
If you're using admin panel you can set it in the Edit record of your resource by using mutateFormDataBeforeSave method.
If the field is hidden, it's not included in the form request. So you need to manually reset it like Daniel explained
The strange thing is I get an value if the field is hidden and I dont want this to happen. What I mean if toggle is 0 I get the default value of compound interval
maybe dont dehrydate when you dont need it
can't use ->dehydrate() on select
Maybe I should check customize_compunding in the backend and not compound interval