Viewing 13 reply threads
  • Author
    Posts
    • #1067
      cosmocanuck
      Member

      Hi folks! Hey, can a field be set up as a single checkbox, for a “yes/no” option? If it’s checked, the value is “Yes”, if not, the value is “No”? Or ‘null’ or ’empty’ I guess, and then I can hopefully use a dash of basic PHP logic on my display template to echo out “Yes” or “No” next to the label for that value?

      I’d much prefer this to having a pair of radio buttons as it’s so much cleaner, but I don’t see an example of this in your Demo.

      Thanks!

    • #1068
      cosmocanuck
      Member

      Sorry, clearly a case of RTFD (read the fine documentation). I assume a single option in the choices array will do it, and I can check for the field’s value in the theme’s appropriate template file.

    • #1069
      Steve
      Keymaster

      That should work.

    • #1072
      ken
      Blocked

      Although it works, but it only for a text field on the failure of two or more

    • #1087
      preston
      Member

      I also had problems setting up a single checkbox field, it would not remain unchecked after save. I ended up using a select box instead.

    • #1088
      Kevin
      Keymaster

      This is fixed in the upcoming release, it was a fun bug 😉

    • #1090
      preston
      Member

      Awesome, thanks Kevin!

    • #1091
      cosmocanuck
      Member

      Hmm, I assume there’s some other factor causing Preston’s bug? ‘Cause my single checkbox works fine. My code is:

      piklist('field', array(
      'type' => 'checkbox',
      'field' => 'snow_cross',
      'label' => 'Snow Cross?',
      'attributes' => array(
      'class' => 'text'
      )
      ,'choices' => array(
      'Yes' => 'Yes'
      )
      ));

      And the checked / unchecked boxes are staying that way….

    • #1097
      preston
      Member

      @cosmocanuck Hm. I was able to reproduce the bug with your code as well.

      I’m using Piklist version 0.8.0b5.

    • #1098
      cosmocanuck
      Member

      Ah! I’m using version 1.0.6. It’s the latest version… you seem to be using an older one? Not sure why that would be the case…

    • #1099
      preston
      Member

      Is 1.0.6 available?

      I only see 0.8.0b5 on the download page: http://wordpress.org/plugins/piklist/developers/

    • #1100
      cosmocanuck
      Member

      I’m sorry, I was looking at the wrong plugin! I’m at version 0.7.2 of PikList. That’s the version it says you get when you download from that URL. Do you have a preview / beta version? it does say b5 at the end so I assume so… that’s probably the problem…?

    • #1101
      preston
      Member

      Yes, I’m using the latest Development Version which is a beta.

      Looking forward to the next release!

    • #1111
      Steve
      Keymaster
Viewing 13 reply threads
  • You must be logged in to reply to this topic.