Skip to content

Toggling boxes based off sortable checkbox type #1629

@bernardmma

Description

@bernardmma

Hi, I was wondering if it was possible to toggle certain boxes based off what field is checked. For example, if I had facebook checked, the facebook box would only show up. The code I currently have below toggles the boxes if any of the checkboxes are checked. If there a way to target options within an id? I've tried variations of 'required' => array('social-networks["fb"]','equals','1'),, but none of those work. Any help would be greatly appreciated.

$this->sections[] = array(
                'icon'      => 'el-icon-user',
                'title'     => __('Social Media', 'redux-framework-demo'),
                'fields'    => array(
                    array(
                        'id'        => 'social-networks',
                        'type'      => 'sortable',
                        'mode'      => 'checkbox',
                        'title'     => __('Order Social Icons', 'options'),
                        'subtitle'  => __('Order and activate/deactivate social icons', 'options'),
                        'options'   => array(
                            'fb' => 'Facebook',
                            'tw' => 'Twitter',
                            'lin' => 'LinkedIn',
                        )
                    ),
                    array(
                       'id' => 'facebook-url',
                       'type' => 'text',
                       'required' => array('social-networks','equals','1'),
                       'title' => __('Facebook URL', 'options'),
                       'subtitle' => __('Enter your Facebook URL.', 'options'),
                    ),
                    array(
                      'id' => 'twitter-url',
                      'type' => 'text',
                      'required' => array('social-networks','equals','1'),
                      'title' => __('Twitter URL', 'options'),
                      'subtitle' => __('Enter your twitter URL.', 'options'),
                    )
                )
            );

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