Multi Select Control Validation

Introduction

This topic illustrate on how to create validation rule for a multi select control for K2 SmartForms. For list view, we can do it easily using the for each condition rule and loop through the list. This can be done for multi select control as it just need more tweak on the rules.

Background

This idea comes about when there is a requirement that the user would like to view the list uploaded files on the multi select control. However, only certain files allow to be selected.

How it works

Basically the upon every selection, we will validate against the specific rule. If it passes the rule, we will store the selected data into a data label. Otherwise, we will revert the multi select data into the data label that has the previous control value.

Steps

  1. Create a multi select control and create some static values for the control
  2. Create 2 data labels, one is for storing of multi select value and another is for validation purpose.
  3. Add a rule for the multi select control on change
    ms1
  4. Add in the transfer data
    MS1.png
  5. Add in for each condition for selected list control (multi select control)
  6. Add in the advanced condition under step 5. This is to specify invalid condition. In this case, i do not want the list of data that contains “.xls” to be selected.
    ms1
  7. Add transfer data rule
    ms1
  8. Add in rule for If control (Validation data label) contains specify content (false)
  9. Add in transfer rule for step 8. Revert the control data as the validation is false.
    MS1.png
  10. Add in else rule
  11. Add in transfer rule for step 10. Save the current control value.
    MS1.png
  12. And you are done!

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s