getListLabels not working with IF statement
3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 30, 2008 (RSS)
By Deborah - October 28, 2008
I'm struggling with display of a field of checkboxes, which allow for multiple selection. As intended, if one or more boxes are checked, the record displays and in the case of a multiple selection, the values are separated by a comma.
If there is one or more checkboxes selected, the record displays as intented. My challenge is that if there are no boxes selected, I would like that the record does not display at all.
I'm using the following code:
<?php if ($realty_listingRecord['heating']): ?>
Heating: <?php echo join(', ', getListLabels('realty_listing', 'heating', $realty_listingRecord['heating'])); ?>
<?php endif ?>
Which results in the following error message if (and only if) there are no checkboxes selected:
"Notice: Undefined index: n/a in /vservers/domainname/htdocs/cmsAdmin/lib/viewer_functions.php on line 1162 n/a"
I previously had a selection of "n/a" in the checkbox list, but have since removed it. I suspect that is the "n/a" I see at the end of the error message.
I'm not sure what I need to correct. Any help on this would be greatly appreciated.
Thanks in advance.
Deborah
If there is one or more checkboxes selected, the record displays as intented. My challenge is that if there are no boxes selected, I would like that the record does not display at all.
I'm using the following code:
<?php if ($realty_listingRecord['heating']): ?>
Heating: <?php echo join(', ', getListLabels('realty_listing', 'heating', $realty_listingRecord['heating'])); ?>
<?php endif ?>
Which results in the following error message if (and only if) there are no checkboxes selected:
"Notice: Undefined index: n/a in /vservers/domainname/htdocs/cmsAdmin/lib/viewer_functions.php on line 1162 n/a"
I previously had a selection of "n/a" in the checkbox list, but have since removed it. I suspect that is the "n/a" I see at the end of the error message.
I'm not sure what I need to correct. Any help on this would be greatly appreciated.
Thanks in advance.
Deborah
Re: [Deborah] getListLabels not working with IF statement
By Dave - October 30, 2008
Hi Deborah,
Do many of the records have the old "n/a" value? If it's just a view you should be able to clear it by clicking "modify" then "save" on those records. Since the checkbox no longer exists it won't be resaved.
Let me know if that works for you.
Do many of the records have the old "n/a" value? If it's just a view you should be able to clear it by clicking "modify" then "save" on those records. Since the checkbox no longer exists it won't be resaved.
Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com
Re: [Dave] getListLabels not working with IF statement
By Deborah - October 30, 2008
Dave,
Your solution worked. I'll keep that in mind in the future.
Thank you!
Deborah
Your solution worked. I'll keep that in mind in the future.
Thank you!
Deborah