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

Understanding Validation

I have read multiple articles about mandatory comments on the Flexitask - if the user has rejected the task. All of them say pretty much the same thing and it works - IF you do not customize your form...

if you keep a standard flexitask form or, at least, do not delete the Comments control, the concept of isNotNullOrEmpty({Self}) && Decision=="2" works perfectly.

I like to brand the forms properly, so I delete all controls and start again in a format more suited to my client. This is when I encounter the issue.

So... The options considered:

  • Control Name,
  • CSS Classes
  • "Cause Validation" on the submit button
  • The format of the  Decision Control - Radio vs. Button

I cleared out my form and added only Decision, Comments and a Submit button, replicating the settings on each control as they are on the standard form... Rule doesn't work. Reset the form - enter exactly the same rule - there it works again.

I would like to understand exactly how the validation works, perhaps a deeper insight will allow for a richer validation experience - really hoping someone can help

Reply
8 Replies
Workflow Hero

Re: Understanding Validation

Hi,

first of all you need to know that all the task outcomes you create (plus the basic ones that exist by default) are stored in the nintex database. In the table they also have an ID. This is the ID you have to check against in your validation rule. If you cannot access the database, you can open the developer tools in your browser and should be able to see the ID of the outcome in the DOM. Be aware that in preview mode all outcomes normally return "0" so you may need to publish your form to test this.

Regards

Philipp

Accept as Solution Reply
Workflow Hero

Re: Understanding Validation

if you just removed all the controls from the form and then placed them back one by one, the same rule should work.

have you assigned the rule to comments controls? how did you created the comment control - have you dragged it from list columns?

as well how did you create rule formula? have you set it up anew or have you copy&pasted it from somewhere?

Accept as Solution Reply
Workflow Hero

Re: Understanding Validation

Hi,

I am aware of the ID check that I need to do and the ID is correct. as explained, the validation rule works when you use the standard form, but as soon as clear the controls and re-add them in the format I want, the validation stops working   

Accept as Solution Reply
Workflow Hero

Re: Understanding Validation

Thanks for the reply.

I have assigned the rule to the comments control. I added the comments control from the toolbox - not add multiline text and then connect to the comments property. 

Lastly, the rule was not copied, I recreated it and ensured that it was set up correctly as it was when I used the standard form

Accept as Solution Reply
Workflow Hero

Re: Understanding Validation

ok.

then I would suggest to put (temporarily) calculated value controls on the form and set up their formulas just like rule formula resp. single rule formula expressions.

that way you will see how exactly they evaluate why they do not provide expected result.

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Understanding Validation

As far as I know those values are not guaranteed for the Approve / Reject choices on a Flexi-Task, which makes validation against them a bit more tricky. 

If I were you, I would assign a Javascript Variable to the Decision field after you have replaced it, and then apply the following rule on your Comment control to achieve what you'd like. 

Please note that in the code below, the name of the variable associated to the Decision control is 'DecisionID' 

isNullOrEmpty({Control:Self}) && NWF$("#" + DecisionID).find("input:checked").siblings("label").text() === "Reject";

If the "Reject" value has been selected, the Comment field cannot be left blank. 

Because this doesn't use the value of the input, you can easily drop this into other forms without much hassle. Additionally, that means that it will also work using the Preview function which makes life easier  

Do you believe that this solves your problem? 

Accept as Solution Reply
Workflow Hero

Re: Understanding Validation

Thanks, it might work, though I would like to not ask my clients to write code, I will give it a try and let you know.

Accept as Solution Reply
Workflow Hero

Re: Understanding Validation

Thanks, let me see what results I get... give me a few hours to check it out

Accept as Solution Reply