Hide Checkbox

4 posts by 2 authors in: Forums > CMS Builder
Last Post: September 2, 2009   (RSS)

I have a client that is looking into displaying a list of schools and there current closings for the upcoming winter season. What they suggested was a set list of schools they will provide to me and a checkbox on if to display that item or not. I tried changing the checked and unchecked value but it still only displayed a 1 if checked and a 0 if not checked. I'm sure it is is possible with your program I am just not sure how! Thank you for your assistance.

Re: [chris] Hide Checkbox

This does not seem to work. I even tried it in the most recent version and it does not work on there either. It must change the value of the field but not what is actually displayed.

Re: [InfamousNugz] Hide Checkbox

By Chris - September 2, 2009

Hi InfamousNugz,

Sorry about that! You are right of course. I should have tested that.

That's actually a bug. I've submitted a patch and hope to have it fixed in the next release.

In the meantime, you can use the following workaround which will keep working properly if you upgrade to a version in which the bug is fixed:

Checkbox: <?php
// output checkbox field
$value = $newsRecord['checkbox'];
if ( $value == '1' ):
echo "Yes";
elseif ( $value == '0' ):
echo "No";
else: // bug has been fixed!
echo $value;
endif;
?><br/>


(Note that you'll need to change the name of the record variable and the field to match what you've got set up, as well as the strings "True" and "False" to your Checked Value and Unchecked Value; everything you'll want to change is highlighted in red above.)

Of course, after the bug is fixed, you can replace that with your original, much simpler, code.

Again, sorry about that! Please let us know if you have any more questions or comments.
All the best,
Chris