Skip to content

Multiselect with require #1829

@ghost

Description

Hi,

There is an issue with multiselect field and require option. I've one multiselect field with few options. Below there are simple text fields that should be displayed when specific option is selected. It's working fine when I select only one option in the multiselect field. When I select additional options all text fields are hidden.

It's working fine after I save the panel (PHP checks the visibility) but it isn't working when I modify the multiselect value (JS check for visibility).

The values from multiselect are returned in JS as array in array so the check if ( $.inArray( checkValue, parentValue ) != -1 ) { from redux.js line 773 isn't working.

You can check the issue with this sample config

array(
    'id'       => 'opt-socials',
    'type'     => 'select',
    'multi'    => true,
    'sortable' => true,
    'title'    => __( 'Socials', 'redux-framework-demo' ),
    'options'  => array(
        'facebook' => 'Facebook',
        'twitter'  => 'Twitter',
    ),
),
array(
    'id'       => 'opt-socials-facebook',
    'type'     => 'text',
    'title'    => __( 'Text Option - Facebook', 'redux-framework-demo' ),
    'required' => array( 'opt-socials', '=', 'facebook' ),
),
array(
    'id'       => 'opt-socials-twitter',
    'type'     => 'text',
    'title'    => __( 'Text Option - Twitter', 'redux-framework-demo' ),
    'required' => array( 'opt-socials', '=', 'twitter' ),
),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions