Clear hidden field on toggle off
The toggle is working well with the field been hidden and shown but the hidden field is not cleared.
3 Replies
Can you make a video of the problem ?
What do you mean by "the hidden ffield is not cleared"?
Do you mean if you edit a record which has 'trustHolder' set, and a value for 'trustee', then you unselect trustHolder, trustee gets hidden, and you save the record? And trustee still has it's old value?
I would expect that to be the case, because hidden fields are not updated when you save. So the field on that row will remain unchanged. You'll probably need to either keep it visible, or manually add it to the data when saving, either with a mutateFormDataBeforeSave() method, or in your own save method (depending whether you are in a panel or standalone context).
So if you are in an admin panel, try this on your EditFoo page ...
Thanks, that was the issue. The value was still being saved after you turn off the toggle.