Default Value for List Checkboxes

5 posts by 4 authors in: Forums > CMS Builder
Last Post: March 6, 2013   (RSS)

By clowden - February 6, 2013

I have a list that I am creating through the "Get options from database" (screenshot attached).

I would like all of the options, 4 of them, to all be checked by default. If I just type in a record number it will select only that one, makes sense, but could notĀ figureĀ out how to select them all. I tried "1,2,3,4" and other combinations like that but nothing worked.

By gkornbluth - February 6, 2013

Hi Clowden,

I assume you mean when a record is created in the CMSB back end and not in a viewer.

I think you'll have to use get options from MySQL Query.

I'm not sure how to set up the code.

Sorry I can't be of more help.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gregThomas - February 13, 2013

Hi,

There isn't a way to do this by default in CMS Builder, but you could create a plugin to do it. You would need to use the plugin hook record_preedit to edit the contents of the request array when an article was created.

We could create this plugin for you if needed. If you send an e-mail to consulting@interactivetools.com, we can give you an estimate of the cost.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Codee - March 6, 2013

I don't know if it would work in this specific case (since I don't have all the details)...BUT...sometimes when I'm up against an issue like this I use 'reverse-programming-psychology'. So I would create a check field for when the element is NOT wanted, if that is the less-than-normal case. Then I add a where filter at the top of the page (if necessary) for the reverse statement instead. Basically, if every record is going to have those items by default, then make the checkbox be positive for 'not' having it by default. Sometimes it ends up easier, simpler, and cleaner code.