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

Re: Using validation rules to ensure a comments box is not left empty

When I click the link you provide, it went to the same page.  I did try your solution with this formula, but it did not work either:

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

of course I put the lable used in my form.  I can still save the form while leaving the box empty

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Using validation rules to ensure a comments box is not left empty

Unless you have something else going on with your Decision names, the names of your controls, or the code pasted into your rule. 

Doing a quick mockup, everything is acting as it should be

Decision Control Name and Options: 

Setting the Rule:


Resulting Validation: 

Code used: 

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

If you have a specific case in which this is not working, can you provide more information about the Approval / Rejection / Whatever options you have set up on your flexi task so that they can be recreated? 


Accept as Solution Reply
Workflow Hero

Re: Using validation rules to ensure a comments box is not left empty

I just realize I have some syntax error in my formula,  let me try again.  one question: when putting in the formula, can I just use copy /paste and change the text?  Do I need to enter via "named controls", "runtime functions"?

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Using validation rules to ensure a comments box is not left empty

I first put in this formula exactly the one you used:

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

It worked in terms of conditional validation based on "Reject" choice, but it had a problem, the comment box remains invalid even after I put some text in the box, it keeps the red frame and red message saying this is invalid, I can't save the form. It seems that it can't recognize {ControlSmiley Frustratedelf} means the box itself is empty.

Then I changed the {controlSmiley Frustratedelf} by selecting the {self} from "Named Controls" as follows, then it worked.

Select "Reject", the box has a red frame, I can't save. After entering text in the box, form is saved.

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

Thanks for your solution, it is a major help!

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Using validation rules to ensure a comments box is not left empty

that's very strange. 

{ControlSmiley Frustratedelf} should automatically resolve to {Self} whenever the rule is evaluated for the first time. The only thing I can think of that may have messed that up is that sometimes, if you copy a text source that has some markup on it (for instance, text from the web, or from this here forum), it can paste that formatting into the formula editor and silently do bad things during runtime. 

I'd be interested to know what would happen if you just put a validation rule on something with the exact text (typed yourself and not copy pasted) isNullOrEmpty({ControlSmiley Frustratedelf})  and then attempted to submit the form leaving that control blank. Ideally it should throw an error, and upon looking at the Rule again, the {ControlSmiley Frustratedelf} should be replaced with the red linked version. 

(But that's only if you really care to go down that rabbit hole) 

Other than that, I'm ultimately glad that your problem was solved. You should be able to use this method to test against any number of Outcome Decisions for future tasks. 


0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Using validation rules to ensure a comments box is not left empty

Hi - in my form I have 2 buttons: 'Save & Close' and 'Submit', and both button actions are set to 'Save and Submit'.  I have found that the validation rule works when I hit the 'Save & Close' button, but not the 'Submit', and I'm not sure why when they both have the same action.

Has anyone else had this issue?  And if so, how was it resolved?

Thank you!

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Using validation rules to ensure a comments box is not left empty

Sorry... I checked again and there was an old formula on the 'Submit' button that was running on Client click and I guess, interrupting the validation process.

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Using validation rules to ensure a comments box is not left empty

I ran into problem again.  the rules I built in March on a multi-outcome task form is broken by nintex form 2.11.4.10 and 2.11.4.20. Now I have to rebuild.

I got one formula working: 

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

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?

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Using validation rules to ensure a comments box is not left empty

I got the 2nd rule formula to work.  It is same as the first formula, except for the end, "..... text()=== "A" || "C". 

Problem solved!

0 Kudos
Accept as Solution Reply