SmartForms changes the order of if-statement with multiple conditions, which causes validation to behave differently

  • 15 February 2022
  • 0 replies
  • 20 views

Userlevel 5
Badge +20
 

SmartForms changes the order of if-statement with multiple conditions, which causes validation to behave differently

kbt152641

PRODUCT
K2 Five 5.0 to 5.2
BASED ON
K2 Five 5.1
TAGS
Rules
SmartForms
This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.

Objective

When you want to have two validation rules on a Form, for example a "When View passes Validation" and a "When Advanced Condition is True" rule, but you want them to fire at different times, then placing them directly underneath each other will result in both rules firing at the same time. In addition, the validation will only pass if both rules are either true or false.

For example, the reproduction would be the following:

Image

If the Form is configured like the above, then the message will not be shown to the user if either the "Form passes validation" is false, or if the advanced condition is false.

Before You Begin

The validation rules were designed to only fire if both are true or both are false.

In other words, with the above example, if the controls on the Form pass validation (no empty text boxes for example) and the advanced condition is also true (1 equals 1) then the message box will be shown to the user.

However, if either the validation did not pass or the advanced condition is not true, then nothing will happen on the Form / View.

How-to Steps

In order to resolve this, you will have to split the two rules apart.

Here is an example of how to do this:

When Button is Clicked
if an advanced condition is true
then show a message to the user (configure) -- disabled
if the View passes validation Configured
then show a message to the user (configure)
 
 
Image

0 replies

Be the first to reply!

Reply