This topic contains 1 reply, has 2 voices, and was last updated by  Steve 3 years, 10 months ago.

  • Author
    Posts
  • #6273

    oakwood
    Participant

    Scenarios:
    1. If I have a group (add_more), with a conditional inside – that works as expected.
    2. If I have a group (add_more), with a conditional outside (controlling whether or not the group is shown) – that works as expected.
    3. If I have a group (add_more), with a conditional outside (controlling whether or not the group is shown), and a conditional inside – that does not work as expected.

    Tested on 0.9.4.29 and 0.9.9.7 (different results on each version).

    <?php
    /*
    Title: test
    Post Type: post
    Order: 1
    Collapse: false
    */
    piklist('field', array(
      'type' => 'radio'
      ,'field' => 'show_hide_group_two'
      ,'label' => 'Radio'
      ,'choices' => array(
        'show_group_two' => 'Show Group Two'
        ,'hide_group_two' => 'Hide Group Two'
      )
      ,'value' => 'hide_group_two'
    ));
    
    piklist('field', array(
      'type' => 'group'
      ,'field' => 'group_one'
      ,'label' => 'Group One - Always On'
      ,'add_more' => true
      ,'fields' => array(
        array(
          'type' => 'select'
          ,'field' => 'show_hide_text_one'
          ,'label' => 'Show or hide text input'
          ,'columns' => 4
          ,'choices' => array(
            'show_text_one' => 'Show'
            ,'hide_text_one' => 'Hide'
          )
          ,'value' => 'hide_text_one'
        )
        ,array(
          'type' => 'text'
          ,'conditions' => array(
            array(
              'field' => 'group_one:show_hide_text_one'
              ,'value' => 'show_text_one'
            )
          )
          ,'field' => 'conditional_text_one'
          ,'label' => 'Conditional Text'
          ,'columns' => 8
        )
      )
    ));
    
    piklist('field', array(
      'type' => 'group'
      ,'field' => 'group_two'
      ,'label' => 'Group Two - Maybe On'
      ,'add_more' => true
      ,'conditions' => array(
        array(
          'field' => 'show_hide_group_two'
          ,'value' => 'show_group_two'
        )
      )
      ,'fields' => array(
        array(
          'type' => 'select'
          ,'field' => 'show_hide_text_two'
          ,'label' => 'Show or hide text input'
          ,'columns' => 4
          ,'choices' => array(
            'show_text_two' => 'Show'
            ,'hide_text_two' => 'Hide'
          )
          ,'value' => 'hide_text_two'
        )
        ,array(
          'type' => 'text'
          ,'conditions' => array(
            array(
              'field' => 'group_two:show_hide_text_two'
              ,'value' => 'show_text_two'
            )
          )
          ,'field' => 'conditional_text_two'
          ,'label' => 'Conditional Text'
          ,'columns' => 8
        )
      )
    ));
  • #6287

    Steve
    Keymaster

    @oakwood– Thanks for letting us know. We’ll get this fixed in the next version of Piklist.

You must be logged in to reply to this topic.