odd form behavior on relationship
From reading through topics and the docs, I've gathered that in order to use a relationship on a form field, I need to use a form layout component and set the relationship.
I have a form in a page component that I'm not populating until the user clicks a button. I'm able to populate the form with what I've got right now, but when it comes time to save,
$this->form->getState()
returns one field but not the one with the relationship.
mount method:
method to populate form:
the form:
3 Replies
That's correct, relationships are saved independently. You can use $this->data if you want the raw data and not the state.
Just keep in mind that $this->data has not been validated.
if you want to access it in the $data, add
->dehydrated()
after ->relationship()