Validation Rule for the dropdown control


Badge +9

Hi All,

I have multiple dropdowns in my form and I want to apply validation(to make dropdown value mandatory) based on a textbox (i.e. if textbox value is not null then dropdown option must be selected else dropdown selection is not mandatory) . I am following https://ootbtutorials.com/2016/02/19/rule-formula-examples-for-nintex-forms/  but validations suggested in the link are not working. Please suggest


13 replies

Userlevel 5
Badge +14

describe what's exactly your problem, hard to guess what are you in fact trying to do...

Badge +9

I have updated the question

Badge +9

Hi Marian,

My problem is similar to validation rule on dropdown control  but isnullorempty() is not woking

Badge +9

In formatting rule I am checking the condition if dropdown==1 the disable the dropdown which is working fine as expected but If I change that rule to validation and click on save red border of validation do appear for a sec but item is getting saved

Userlevel 5
Badge +14

can you post how did you set up the rule?

make sure you reference control (named controls tab) in rule and not item field.

check developer console and make sure there are no errors reported.

try to put rule's condition into calculated value control and check how does it evaluate and whether it's what you expect.

if the rule is complex break it up into smallest possible pieces and try to check every singe part separatelly.

Badge +9

Thanks for the reply. Actually I am seeing the weird behavior .Following are the steps performed

  1. Added a dropdown named Country with only values "India" and  "USA"
  2. Added a rule by selecting "Country" from the control tab and tried to check isNullorEmpty(Country) but the condition didn't work
  3. Added a rule  Title!= " " && (Country !="India" || Country !="USA") .This rule is working and showing the red border .
  4. After that even  if I select "India" or "USA" I am getting validation warning with red border which means the dropdown is unable to read the updated value

I wont be able to upload the screenshot due to the company policy

Badge +9

I created two lists with same dropdown. In one its working as expected but in another its giving syntax  error in console for the line

eval(val.clientvalidationfunction + "(val,args);");

Userlevel 5
Badge +14

I would say you have an error in some (other), or with values supplied to rule to evaluate.

let it break on error and in console examine content of 'val' and 'args' variables. it might give you a hint what's wrong.

Badge +3

Hi,

If you rule is exactly like the above then your error is thrown whenever your TITLE doesn't equal a space i.e Title != " ".  It should be Title != "" without the space.  I have also found that if I use the Nintex functions of And and Or it often computes / executes more consistently than the normal scripted && and ||

Badge +9

Actually the form is custom with javascript code and multiple rules so I am not getting that error. On my test list where I was getting the same error I deleted the form and recreated the form and the error is gone but I cannot recreate the form in my main list .

Badge +9

Thanks for your reply. Actually I am getting an error of syntax in the nintex form.I deleted the form and recreated and now there is no error

Userlevel 5
Badge +14

sorry, I'm confused with your reply.

are you still experiencing an error or not?

Badge +9

Felipe AbreuCraig TarrMarian Hatala​.

After losing half of hair I finally got the root cause.

Cause:

  1. I have multiple columns  i.e.feild1,feild2,feild3 and depending upon the stage of the Workflow their position changes in the form due to which I have created multiple panels.
  2. My columns exits in multiple panels and since columns are enabled only in one panel my flow was working fine.
  3. If you include same column in multiple panels and add  rules regarding validations then the syntax error will appear in console  else it wont,hence in one list my validation was working for the column where as in other list it was throwing error or the same column.

Resolution:

I replaced all the disabled columns with the calculated values.

Thanks for the reply

Reply