Save default input value in DDBB
Hi I have a form that is stored as json in de DDBB.
The problem is with the default value of a select component. The select have 3 values (To do, In progress, Done), and the To do value is set as default.
When i save the form with other two values selected, the select value are stored correctly in the ddbb, but when the default value is selected, it doesn't appear.
I need to save the default value because when I search on the json with a Query, i need to give it.
11 Replies
Hi, do you know how to do it?
can yo show the code? sounds weird
the select:
$this->options = [
'to_do' => 'To Do',
'in_progress' => 'In Progress',
'awaiting_block' => 'Awaiting/Block',
'done' => 'Done',
]
The problem is when I create or edit an entity by the form, in the
$data
of mutateFormDataBeforeSave()
doesn't appear the select data if default value is selected.
and the same in the mutateFormDataBeforeCreate
If is not the default value, for example i select Done, it appears correctlyare you on the create or edit page
In the 2
defaults are only filled on create
No, i debug in the create, and doesn't appear
as you can see, only appear in_progress. There are 2 more selects with default value to_do and it doesn't appear
As you can see here, when I select one of three others values, all appear correctly, but when I select the default value, it doesn't appear
I have this function to check if the select have value. If i don't have value, there is any way to set the value on the state? Anythink like setState()
??