cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Make a box mandatory if either one of the two conditions met in decision box in multi-outcome task form

Jump to solution

A multi-outcome task form has 3 choices in the decision box, A,B,C.  

One rule is to make a box mandatory if B is selected in decision box.

I got one formula working: 

isNullOrEmpty({Self}) && NWF$("[data-controlname='Decision'] input:checked").siblings("label").text() === "B"

The other ruls is - 

I need to set a rule on another box to make it mandatory if A or C is selected.  Can someone help me on the formula this rule?

Thanks in advance!

0 Kudos
Reply
11 Replies
Workflow Hero

Re: Make a box mandatory if either one of the two conditions met in decision box in multi-outcome task form

Jump to solution

Following from the first rule you used (isNullOrEmpty AND "B"), you could try (isNullOrEmpty AND ("A" OR "C")). That is:

isNullOrEmpty({Self}) && (NWF$("[data-controlname='Decision'] input:checked").siblings("label").text() === "A" || NWF$("[data-controlname='Decision'] input:checked").siblings("label").text() === "C")

0 Kudos
Reply
Workflow Hero

Re: Make a box mandatory if either one of the two conditions met in decision box in multi-outcome task form

Jump to solution

I got it to work yesterday using the same formula as the first one, except text()=== “A” || “C”.

Thanks

0 Kudos
Reply
Workflow Hero

Re: Make a box mandatory if either one of the two conditions met in decision box in multi-outcome task form

Jump to solution

Hi Michael,

Actually the problem still exist – the formula I used works on showing the red frame when mandatory data is missing, but after filling the required data, the form cannot be saved.

isNullOrEmpty() && NWF$("[data-controlname='Decision'] input:checked").siblings("label").text() === "Rejected" || "Not done - need more information"

Then I tried the formula you suggested, but it does not validate the required data, ie. Form can be saved while required data is missing

isNullOrEmpty(
) && (NWF$("[data-controlname='Decision'] input:checked").siblings("label").text() === "Rejected" || NWF$("[data-controlname='Decision'] input:checked").siblings("label").text() === "Not done - need more information")

Do you any new suggestions?

Thanks!

0 Kudos
Reply
Workflow Hero

Re: Make a box mandatory if either one of the two conditions met in decision box in multi-outcome task form

Jump to solution

Firstly, in the formula you pasted, you're missing the {Self} named control in the IsNullOrEmpty() function -- I'm not sure if that's just a pasting error in your post or in your actual form design itself, so you might want to check that.

Secondly, where are you entering these validation formulae? As validation rules on the control(s)? If that's the case, then the presence of the NWF$ namespace is a bit concerning as this is usually required for JavaScript referencing and should be unnecessary for checking the value of the option selected.

Finally, without diving any deeper into your particular implementation, I just whipped up something quick in a basic form (note: this is not a Task Form, but I think the same logic should apply) to demonstrate the conditional validation on a couple of text boxes based on the option selected in a Choice control.

The Form Design

Based on your original description, I imagine there's a Choice control that allows for the selection of 1 out of a possible 3 choices. Depending on which option is selected, some "boxes" (assumed single line textbox) will become mandatory fields. The sample form appears as follows:

The relevant control properties are shown below:

Choice

Name: Decision

Required for B

Validation rule: isNullOrEmpty({Self}) && Decision == "B"

Required for A or C

Validation rule: isNullOrEmpty({Self}) && (Decision == "A" || Decision == "C")

The Result

Option A selected and "Required for A or C" is blank:

Option B selected and "Required for B" is blank:

Option C selected and "Required for A or C" is blank:

Hopefully this helps.

Reply
Workflow Hero

Re: Make a box mandatory if either one of the two conditions met in decision box in multi-outcome task form

Jump to solution

Thanks Micheal,

But I ended up using two rules, instead of one with “OR” to accomplish this, and it works.

0 Kudos
Reply
Workflow Hero

Re: Make a box mandatory if either one of the two conditions met in decision box in multi-outcome task form

Jump to solution

What version of Nintex are you on?

0 Kudos
Reply
Workflow Hero

Re: Make a box mandatory if either one of the two conditions met in decision box in multi-outcome task form

Jump to solution

Michael,

What Nintex version are you on? I'm not able to use the text values in the way that you present. I have NW 2013 version: 3.3.1.0 and Nintex Forms 2013 2.11.4.30. Instead, I'm forced to use the numeric values from the NW content database for each outcome. I'm trying to figure out options to avoid using these numbers.

0 Kudos
Reply
Workflow Hero

Re: Make a box mandatory if either one of the two conditions met in decision box in multi-outcome task form

Jump to solution

Roberto, I'm on Nintex Forms and Workflows 2016 (4.3.3.0 for both), so I can't really speak to your version and its differences, if any. Also, you mention your issue is related to NW (Nintex Workflow I assume) where the above was posted in relation to validation rules on Nintex Forms.

0 Kudos
Reply
Workflow Hero

Re: Make a box mandatory if either one of the two conditions met in decision box in multi-outcome task form

Jump to solution

Thanks. I'll try Nintex Forms/Workflow 2016. Are you editing a the task form from a Flexi-task action in a Nintex workflow as I am, or are you editing some other type of form? Can you please describe the steps you take to get into the form designer?

0 Kudos
Reply