How to set multiple values from one form component
I have a form component that consists of two fields. But only one field is able to fill the state. Is it possible to get back two values for the state attribute of a custom field?
7 Replies
I think the only solution is using an array
as the value for
state
?Yes
thanks, i'll try that
Thanks! It even works with object π
Only thing is that the state now needs to be handled when saving the form. Is there a way the component can do this while dehydrating?
Via a cast?
i'm now looking if
mutateDehydratedStateUsing
is what i'm needing
It needs to add two keys to the state and remove one. That's what i'm now doing in the code that handles the form submision. From what I understand mutateDehydratedStateUsing
only gets the state of the component, not he whole form.why not a cast on the model?
you can get the whole form with $record.