Follow us on
  1. Hi,

    I need something like that. Fields have dependencies, but dependencies are only for showing or hiding fields. However, I want to both show the area and change its value. Is it possible?

    Posted 2 years ago #

  2. Codestar
    Admin

    Hi,

    Uh no, it's not possible. It's only makes show/hide.

    Regards, Codestar

    Posted 2 years ago #
  3. Hi,

    Oh no!. this is bad news. Because, there is a problem. If you try nested dependencies, you will see that the 3rd item is not able to be hidden when you hide the second dependency by changing the first dependency.

    Posted 2 years ago #

  4. Codestar
    Admin

    Hi,

    Are you sure for 3rd item check first item dependency. I mean:

    array(
      'id'          => 'opt-nested-select-1',
      'type'        => 'select',
      'title'       => 'If selected to (Black) or (White) --->',
      'placeholder' => 'Select a color',
      'options'     => array(
        'blue'      => 'Blue',
        'yellow'    => 'Yellow',
        'green'     => 'Green',
        'black'     => 'Black',
        'white'     => 'White',
      ),
    ),
    
    array(
      'id'          => 'opt-nested-select-2',
      'type'        => 'select',
      'title'       => '---> and selected to (Large) --->',
      'placeholder' => 'Select a size',
      'options'     => array(
        'small'     => 'Small',
        'middle'    => 'Middle',
        'large'     => 'Large',
        'xlage'     => 'XLarge',
        'xxlage'    => 'XXLarge',
      ),
      'dependency'  => array( 'opt-nested-select-1', 'any', 'black,white' ),
    ),
    
    array(
      'id'          => 'opt-nested-select-3',
      'type'        => 'select',
      'title'       => '---> and selected to (Hello)',
      'placeholder' => 'Select a word',
      'options'     => array(
        'hello'     => 'Hello',
        'world'     => 'World',
      ),
      'dependency'  => array( 'opt-nested-select-1|opt-nested-select-2', 'any|==', 'black,white|large' ),
    ),
    
    array(
      'type'       => 'notice',
      'style'      => 'success',
      'content'    => 'Congratulations, You are here now!',
      'dependency' => array( 'opt-nested-select-1|opt-nested-select-2|opt-nested-select-3', 'any|==|==', 'black,white|large|hello' ),
    ),CopyCopied!

    Focus ( In nested dependencies you should control the parent dependencies always ):

    'dependency' => array( 'opt-nested-select-1|opt-nested-select-2|opt-nested-select-3', 'any|==|==', 'black,white|large|hello' ),CopyCopied!

    Btw, another usage for nested dependency it's more readable (if you needed):

    'dependency' => array(
      array( 'opt-nested-select-1', 'any', 'black,white' ),
      array( 'opt-nested-select-2', '==', 'large' ),
      array( 'opt-nested-select-3', '==', 'hello' ),
    ),CopyCopied!

    But still you can't change value. You can use PHP for value control.

    REgards, Codestar

    Posted 2 years ago #