Tagged: checkbox single value
- This topic has 13 replies, 5 voices, and was last updated 8 years, 4 months ago by
Steve.
-
AuthorPosts
-
-
September 9, 2013 at 12:42 pm #1067
cosmocanuckMemberHi 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!
-
September 10, 2013 at 3:04 pm #1068
cosmocanuckMemberSorry, 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.
-
September 10, 2013 at 10:23 pm #1069
SteveKeymasterThat should work.
-
September 13, 2013 at 5:40 am #1072
kenBlockedAlthough it works, but it only for a text field on the failure of two or more
-
September 19, 2013 at 6:12 pm #1087
prestonMemberI also had problems setting up a single checkbox field, it would not remain unchecked after save. I ended up using a select box instead.
-
September 19, 2013 at 6:15 pm #1088
KevinKeymasterThis is fixed in the upcoming release, it was a fun bug 😉
-
September 19, 2013 at 8:21 pm #1090
prestonMemberAwesome, thanks Kevin!
-
September 20, 2013 at 2:27 am #1091
cosmocanuckMemberHmm, 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….
-
September 20, 2013 at 1:59 pm #1097
prestonMember@cosmocanuck Hm. I was able to reproduce the bug with your code as well.
I’m using Piklist version 0.8.0b5.
-
September 20, 2013 at 2:38 pm #1098
cosmocanuckMemberAh! 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…
-
September 20, 2013 at 5:28 pm #1099
prestonMemberIs 1.0.6 available?
I only see 0.8.0b5 on the download page: http://wordpress.org/plugins/piklist/developers/
-
September 20, 2013 at 6:11 pm #1100
cosmocanuckMemberI’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…?
-
September 20, 2013 at 6:45 pm #1101
prestonMemberYes, I’m using the latest Development Version which is a beta.
Looking forward to the next release!
-
September 23, 2013 at 12:57 pm #1111
SteveKeymasterFixed in Beta 6
You can download it from Trunk at WordPress.org >
-
-
AuthorPosts
- You must be logged in to reply to this topic.