Welcome to

The Conxsys Blog

Thoughts on Conxsys, Notes/Domino, LotusScript, & Technology

SnTT: Creating a Master Checkbox

April 26th, 2007 by Corey Davis

For my first Show n’ Tell Thursday entry I thought I would start off with something that I was working on recently: creating a master checkbox. This would probably fall under the beginner category.

If you have never heard of a master checkbox then don’t worry…I made it up. Well, the term anyway, not the idea. And if someone out there tells me that there truly is such a term and that I have defined it correctly, then that would be just plain lucky.

So what exactly is a master checkbox? Well, it’s a checkbox that, when checked, automatically checks off other checkboxes. Okay, so that sounds pretty stupid when worded that way, but that is what it does. Maybe an example would be better.

We are currently working on Logistic for Lotus Domino v1.5. One of the things we are getting around to are some small usability tweaks. For example, when scheduling jobs you can choose to run each one on any combination of weekdays you choose. Such as Monday, Wednesday, and Friday. Or Tuesday and Wednesday. Or the entire week. The method used to select day of the week is, obviously, checkboxes. If you choose to select the entire week, you must check all seven boxes for Sunday – Saturday. Not the end of the world, but if you can make your users life just a bit easier by giving them one checkbox for the entire week, why not? Besides, while my example may not been all that exciting, I’m sure you can think of a million better ways to implement it.

Here is where we are trying to get:

To accomplish this, you will need three fields. One will be the Every Day checkbox, the second will be the set of Sunday – Saturday checkboxes that will be used for display only when Every Day is checked, and the third will be a secondary set of Sunday – Saturday checkboxes that the user can check if Every Day is unchecked.

As soon as I mentioned that this required three fields you might have stopped right there and thought, “Dude, you could do this with just one field that contains eight checkboxes: Every Day, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday.” The problem with that approach is how to handle the inevitable situation were a user selects Every Day and Wednesday. Do you actually process the job every day of the week, or just on Wednesday? The answer is it is a trick question. Never let your UI get you into a situation were your user can select conflicting configurations. Never ever. Take the extra time to create the three fields. This is really simple, I promise.

Here’s what we have from the Designer perspective:

The first field, cbDomainJobDaily, has one choice:

Every day|1

The Default Value is set to:


This is so that the box is unchecked by default. It is also important to note that Refresh Fields on Keyword Change is checked so that the hide-when formulas get reevaluated whenever this box is checked or unchecked.

The second field, cbDomainJobDaysChecked, will be used for display only. It has seven choices:

Sunday | 1
Monday | 2
Tuesday | 3
Wednesday | 4
Thursday | 5
Friday | 6
Saturday | 7

It contains a Default Value of:

val := “1;2;3;4;5;6;7″;

This basically checks all the boxes.

Besides the entry in the Default object, it also contains a value of 0 in the Input Enabled object which is responsible for making sure that the fields are grayed out and do not allow user input. Finally, it also contains the following hide-when formula:

@If(cbDomainJobDaily != “1″)

If you haven’t guessed, when the user checks Every Day in the cbDomainJobDaily field, this field will display the Sunday – Saturday checkboxes as checked but grayed out.

Our third field, cbDomainJobDays, also has seven choices:

Sunday | 1
Monday | 2
Tuesday | 3
Wednesday | 4
Thursday | 5
Friday | 6
Saturday | 7

It contains an Input Translation value of:

val := “1;2;3;4;5;6;7″;
@If(cbDomainJobDaily = “1″;

This part may not actually be necessary for you, but for me it saved a ton of time. Remember, I am adding this Every Day option into an already existing application. Our Job Engine is coded to look for the cbDomainJobDays field in order to determine what days jobs are allowed to run. I could have modified the engine to also look for cbDomainJobDaily, but that would require a modification to the engine code which I already know is in good working order. To prevent the possibility of creating a bug in already good working code, I chose to force this field to check all boxes automatically if the Every Day box is checked. That way, the engine remains unmodified and all changes are now confined to this single form.

And there you have it. The Master Checkbox. From this:

To this:

Tags: , , , , ,
Posted in SnTT, 2,292 views, 2 Comments
Digg This Submit to del.icio.us Submit to Technorati  

2 Responses

  1. Ulrich Krause Says:

    great tipp !!

  2. Patrick Kwinten Says:

    great tip! nice and clear described. Thanks!

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

CC-GNU GPL Creative Commons License
The Conxsys Blog by Corey Davis is licensed under a Creative Commons Attribution 3.0 Unported License unless otherwise specified. Based on a work at conxsys.com/blog. All code on this blog is licensed under the CC-GNU GPL version 2.0 or later unless otherwise specified.

Copyright © 2006-2010 by Conxsys | Login | Powered by Wordpress | Template based on a design by Design4