Repeating section validation using rules issue

  • 27 September 2017
  • 7 replies
  • 21 views

Badge +8

I have a repeating section for fields and I'm using validation rules. However when I submit the form I see the  validation message (see screen shot)  then the form submits by itself. This might be confusing for the end user.

Any one have a suggestion on how to fix this?


7 replies

Userlevel 5
Badge +14

Could you post the rule here, and little more information about the two control fields that are failing? It could help in recreating the issue. 

Also. Are they actually invalid, or are they just showing as being invalid but actually are not? 


Badge +5

Yeah. Agreed with ‌.

Can you share more information on your issue here ? What rules are you using and what are you trying to achieve?

Badge +8

Abdullah Fahmi Mohd Fuadnmarples‌ , the equipment is a required choice field &  quantity is a required number field should be between 0-10.

Rule I'm using: 

1. Equipment field

and(isNullOrEmpty(ServicesRequiredItem) , contains(RequestType, "Equipment"))

2. Quantity field

and(lessThanOrEqual({Self}, 0), contains(RequestType, "Equipment"))

I'm trying to get the user to enter those two fields before submitting. User once submits the form it will show the same as the screen shot but submission doesn't fail. The styling of the control shows invalid although it is valid. This is confusing for end user. 

Userlevel 5
Badge +14

Even with your rules, which seem to check out, I cannot reproduce this error. 

Could you possibly export your form to an xml file, and upload it here, so that we can take a closer look at it? 

Also, perhaps more importantly, which version of Nintex Forms are you using??? I know that there was a change a few versions ago which altered the way that the control errors were evaluated during form submit. 

Badge +5

"User once submits the form it will show the same as the screen shot but submission doesn't fail."

Do you mean it stays on this page but list item gets created? are you using Save and Continue button?

Badge +8

I have exported the form find it in the attachment. 

Userlevel 5
Badge +14

I have looked over the form and attempted to replicate things as best I could. Obviously you're using some javascript libraries that were not included, and some controls that are linked to lists that I could only partially re-create, so it's difficult to pin down exactly why it would be failing in your environment. 

That aside. There were a few potential problems that might be causing a false positive for validation. 

1) Remove the Control Based Range Validation on the Quantity control! There is a bug inside of the Nintex Validation code for Repeating Sections that will destroy your life and make you a sad human... Move your range validation into a rule on the control (which you seem to be partially doing with the EquipmentVR_2 rule)!!!

Note: I am almost sure that the control based range validation is causing the problem because it seems to be totally broken!

 

For the Devs in the house: 

Most controls that have range validation will put a few attributes onto the control's element proper, which will be used to determine if the control's value falls into a specific range. For whatever reason, on range validation for Single Line Text controls. The min / max ranges are put onto the actual Validator (<span/>), which works just fine, until... It gets put into a Repeating Section. Because the Repeating Section renders most Validator spans useless, it'll generate both the useless junk validators that it copied from the invisible hidden root row, as well new ones that point to the right place. The problem is that it creates them (the new supposedly good ones) WITHOUT those (min/max) values, so they attempt to validate using ranges that are undefined, causing an error and causing the form to *almost* post, but then stop, regenerating with correct id attributes on all of your Repeating Section controls and good Validators, which will then correctly evaluate. 

But it's that strange moment between the bad and the good validators that can create a world of hurt if you're trying to figure out why your form is just breaking for seemingly no reason. 

I ran into this same very thing several months ago and it took me a couple of hours to finally pin down what in the heck was breaking! I hope that the devs can give it some attention even if it turns out to not be the problem here. 

2) Remove all custom javascript! Try removing all of your custom javascript and doing testing like that. I can't exactly even figure out what the javascript that you have written in there is doing as there are no controls which would all under '$("input[type='checkbox']:eq(0)")', but you should also remove the remote javascript file that you have being imported into the document at runtime. 

3) Remove your custom javascript on  your Save and Submit and Cancel buttons!

It should be a lot easier to track down what is going on after you have reduced the form back down into a rudimentary state.

Other Notes: You seem to be redirecting to the 'Site URL' on your cancel button, but you have wrapped the Site URL string inside of additional double quotes, which Believe is necessary. 

Instead, try something like: 

window.location.href({Common:WebUrl})

Edit1: updated words that were either missing or confusing. 

Reply