checkboxes... troubling me again!
5 posts by 4 authors in: Forums > CMS Builder
Last Post: February 24, 2011 (RSS)
By Deborah - August 4, 2010
I have a checkbox field named favorite_blog with field values of Yes and No.
Header code:
list($blogRecordsFav, $blogMetaData) = getRecords(array(
'tableName' => 'blog',
'limit' => '3',
'allowSearch' => false,
'where' => " favorite_blog LIKE '%\Yes\t%' ",
));
HTML code:
<ul>
<?php foreach ($blogRecordsFav as $record): ?>
<li><a href="<?php echo htmlspecialchars ($record['_link']) ?>"><?php echo htmlspecialchars ($record['title']) ?>
<?php foreach ($record['favorite_blog_photo'] as $upload): ?>
<img src="<?php echo htmlspecialchars ($upload['thumbUrlPath']) ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /></a></li>
<?php endforeach ?>
<?php endforeach ?>
</ul>
The above code displays nothing. Is there anything obviously wrong? (a v2.4 site, by the way)
Would sincerely appreciate any assistance.
~ Deborah
Re: [Deborah] checkboxes... troubling me again!
By Chris - August 4, 2010
Try replacing:
'where' => " favorite_blog LIKE '%\Yes\t%' ",
...with:
'where' => " favorite_blog = 1",
Does that help? Please let me know.
Chris
Re: [chris] checkboxes... troubling me again!
By Deborah - August 4, 2010
I tried that 'where' code snkppet earlier today, but it was obviously in conflict with something else I had going (or not going) with the HTML code then.
All working great now. Thanks so much for your quick response!
~ Deborah
Re: [Deborah] checkboxes... troubling me again!
By sublmnl - February 23, 2011
I had to change a regular list option into a multiple select checkbox list for a client.
I made the usual 'where' call above the head tag for 'Monday'.
Then I was pulling my hair out until I found this old post and came up with the answer.
'where' => "day_of_week2 LIKE '%\Monday\t%' ",
You guys should put that in the Documentation.
[crazy]
Re: [sublmnl] checkboxes... troubling me again!
By Jason - February 24, 2011
You'll want to make sure you have tab characters on either side of your value like this:
'where' => "day_of_week2 LIKE '%\tMonday\t%' ",
Thanks for the suggestion. We'll looking into adding some more information on how these lists work.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/