Viewing 3 reply threads
  • Author
    Posts
    • #5771
      Ben
      Member

      I have a meta-box with three checkboxes: checkbox_1, checkbox_2, checkbox_3
      checkbox_2 and checkbox_3 should only appear if checkbox_1’s value is “true”.
      checkbox_3 is set to use the “field” template (‘template’ => ‘field’)

      The result is that checkbox_3 always appears in edit/new post view, regardless of checkbox_1’s value. This also happens for text fields.

      The attachment shows what I am seeing before and after checkbox_1 is checked

      /*
      Title: Condition Checkbox Test
      Description: Description for Condition Checkbox Test
      Post Type: post
      */
      
      piklist('field', array(
        'type' => 'checkbox',
        'field' => 'checkbox_1',
        'value' => 'false',
        'choices' => array(
          'true' => 'Show controls',
        )
      ));
      piklist('field', array(
        'type' => 'checkbox',
        'field' => 'checkbox_2',
        'choices' => array(
          'true' => 'Foo'
        ),
        'conditions' => array(
          array(
            'field' => 'checkbox_1',
            'value' => 'true'
          ),
        ),
      ));
      piklist('field', array(
        'type' => 'checkbox',
        'field' => 'checkbox_3',
        'template'=> 'field',
        'choices' => array(
          'true' => 'Bar'
        ),
        'conditions' => array(
          array(
            'field' => 'checkbox_1',
            'value' => 'true'
          ),
        ),
      ));

      Wordpress 4.4.1
      PikList 0.9.4.29
      twentyfifteen child template

      Attachments:
      You must be logged in to view attached files.
    • #5782
      Steve
      Keymaster

      Try the latest beta. I think that may help.

    • #5798
      Ben
      Member

      Problem is still there.

      I removed the existing piklist folder from the plugins directory, then unzipped the beta version. I then went to PikList – Settings and let it update the database. Piklist shows as version 0.9.9.7. All Piklist settings are enabled. The Demos are deactivated.

      No errors in the browser or console. I have debugging enabled both to a log file and the screen. I don’t have any caching plugins enabled. I also tried incognito mode in chrome and a different browser (firefox) to make sure browser-caching wasn’t causing a problem.

    • #5818
      Steve
      Keymaster

      @beng– You may have to change checkbox_1 to a select box. By only have one option, true, I think it’s triggering the condition.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.