not flatten select
- This topic has 2 replies, 2 voices, and was last updated 4 years, 6 months ago by
Anh Tran.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
October 28, 2020 at 3:44 PM #22620
Aart Jan van der Linden
ParticipantHi!
I'm facing an issue where a select is not saving data when the options-array is not flat. I even tried using your exact demo-data, but it's not saved.
The selected value does make it into the POST headers, so it looks like some sort of validation that stops the data from being saved? The plugin even overwrites manually entered data, so it seems to be convinced that the field should be empty.
Changing 'flatten' to true/false does not seem to help.'fields' => [ [ 'name' => 'Beroep', 'id' => 'profession', 'type' => 'select', 'flatten'=>false, 'options' => array( array( 'value' => 'monkeys', 'label' => 'Monkeys' ), array( 'value' => 'king_kong', 'label' => 'King Kong', 'parent' => 'monkeys' ), array( 'value' => 'curious_george', 'label' => 'Curious George', 'parent' => 'monkeys' ), array( 'value' => 'donkeys', 'label' => 'Donkeys' ), array( 'value' => 'eeyore', 'label' => 'Eeyore', 'parent' => 'donkeys' ), array( 'value' => 'guss', 'label' => 'Gus', 'parent' => 'donkeys' ), ), ],
October 28, 2020 at 4:43 PM #22621Aart Jan van der Linden
ParticipantI think I found a solution: it works if the options array has keys:
'fields' => [ [ 'name' => 'Beroep', 'id' => 'profession', 'type' => 'select', 'flatten'=>false, 'options' => array( 'monkeys'=> array( 'value' => 'monkeys', 'label' => 'Monkeys' ), 'king_kong' => array( 'value' => 'king_kong', 'label' => 'King Kong', 'parent' => 'monkeys' ), 'curious_george' => array( 'value' => 'curious_george', 'label' => 'Curious George', 'parent' => 'monkeys' ), 'donkeys' => array( 'value' => 'donkeys', 'label' => 'Donkeys' ), 'eeyore' => array( 'value' => 'eeyore', 'label' => 'Eeyore', 'parent' => 'donkeys' ), 'guss' => array( 'value' => 'guss', 'label' => 'Gus', 'parent' => 'donkeys' ), ), ],
December 1, 2020 at 2:51 PM #23133 -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.