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 clowden - February 6, 2013

Correct. I want all of my list options to be checked by default when myself or another users creates a new record.

Just wanted to attach that screen to show how the list was generated and the default options I was talking about.

Thank you.

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.