K2 SmartForms Set A Value in CheckBox Lists

Developing in K2 SmartForms

Many K2 forms require that form display options in a Check Box list. With K2 Smartforms it’s fairly simple to add the CheckBox list control to your form but not as intuitive to set checked values of the CheckBox List.  There’s a trick with setting the values (multiple values) through a parameter.

Add a Check Box List control to your form

Once you’ve added the Check Box List control select the control on the for and edit the properties.  You’ll want to select the Data Source Type ellipse to configure the Data Source.  Select Use a SmartObject as data source; then set your method (Get List), the Value field and then the Display.  The value field is what you will be passing into the Check Box list control to set the selected items.

In your form be sure to setup a parameter, in this case, I’ve just called it “YourParameter” and then set the rules.

As above I’ve added the rules to the form Initialization rule. The first rule will populate the Check Box List with the whole list if no parameters are set.  The conditional rule statement will check if there is a value in the parameter “YourParameter” from the query string ( \?YourParameter=item1;item2;item3).  If there is a value in the parameter then I use the transfer data rule to pass the parameter values to the Check Box List control.

Once you have the parameter set to pass you can run the form with or without parameters.

With parameters
Without parameters







Remember when you call the form with parameters and you have multiple items that have been selected you will need to delineate the parameters with a semicolon.

Happy Check Boxing.

About jasonbu 56 Articles
I'm a wannabe extrovert and an Interweb nerd who has spent the past 25+ years in the software industry. My first 10 years at Microsoft. I've served in the Canadian Military; I'm a humanist; I love coffee; love all things science and love spending time with my family.