not flatten select

Support General not flatten selectResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #22620

    Hi!

    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' ),
                             ),
                        ],
    #22621

    I 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' ),
                             ),
                        ],
    #23133
    Anh TranAnh Tran
    Keymaster

    Hi,

    Thanks a lot for your feedback. This is an edge-case in the plugin and I've fixed it on Github, which will be added in the next version.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.