Skip to main content
Nintex Community Menu Bar

Attachment validation Nintex Form

  • June 20, 2018
  • 5 replies
  • 98 views

Forum|alt.badge.img+1

Hi People, have anyone tried to check the number of attachments in a Nintex Form? I'm trying to use Javascript validation, using custom function found here at the forum

(NWF.FormFiller.Attachments.GetAttachedFilesCount(NWF.FormFiller.Functions.GetFillerDivObjectForControl(NWF$("#"+NWF$("." + attCtrlClassName + " .nf-attachmentsRow")[0].id)).data('controlid'))) <1 

To make it return true or false if no attachment is added.

216641_pastedImage_1.png
added the custom class both to custom CSS and to the formatting CSS class of the attachment control. I am able to check the javascript function using the google chrome console

216642_pastedImage_2.png

and the rule seems to be fine

216693_pastedImage_5.png

However after I submit the form, no error message is displayed and the forms submits perfectly. I've tried changing the function several times and validating using nintex runtime functions, basically everything, nothing seems to work.

In the console it is displayed the error message

216643_pastedImage_3.png

Twice, it still submits the form and no validation is done.

Similar happens with the attachment control settings, just like in the image.

216692_pastedImage_4.png

No validation is done at all.
¿Is there a possible way to do it?

5 replies

Forum|alt.badge.img+14
  • Scholar
  • June 25, 2018

I'd say it should work...

if you click on the exception in developer console, where does it point you to?

can you try to remove validation rule and check developer console, whether the error still doesn't appear there?

try to configure it as advised here - https://community.nintex.com/message/42747?commentID=42747#comment-42747 

ie. let the function return just a number and make logical comparison within the rule itself.


Forum|alt.badge.img+1
  • Author
  • June 25, 2018

I just removed all the rules from the form, saved, published and then tested just submitting the for without any required field filed. The same errors are displayed in the chrome console:

216726_pastedImage_1.png

The only one that points me somewhere is the highlighted one, that gets me to

216727_pastedImage_2.png

Still nothing looks unfamiliar or wrong.

I've tested with every single field in the form, letting it be the only one not filled, all of them display the same error after the form has been submitted.

The only custom validator I am using is a date one, where I validate if the date has been fulfilled and if it is not before today, it works fine so i don't think it is that field fault.

I was using that JavaScript validation function and other ones but none of them seems to work. I'm using a corporate version of Nintex, could it be that it has restrictions or something like that? It doesn't seems to work no matter what I do.

I was thinking that maybe recreate the form would help, but I dont really know if that would be a good idea.


Forum|alt.badge.img+1
  • Author
  • June 25, 2018

Shouldn't this control validation

216728_pastedImage_1.png

just work fine without the need of javascript? I've tried erasing this validation, erasing the field, erasing the rule, basically everything.


Forum|alt.badge.img+14
  • Scholar
  • June 25, 2018
I just removed all the rules from the form, saved, published and then tested just submitting the for without any required field filed

so you definitely have an error on the page. sounds to be some syntax error like missing/one more quote, brace, comma, etc.

review all your javascript code, rule's formulas, calculated value controls, etc.

if it doesn't point you to a place in code where the error happened once you click on one of first two rows, it means parser cannot correctly interpret page code. since it pointed you to a curly bracket somewhere in the middle of CSS declarations it looks like it expects the brackets closes some block of code.

note, it may well be problem of input data provided into some control and you process by a formula/rule/code. if it contains some sensitive characters like quotes, braces, commas, slashes... and they are not properly escaped they might be misinterpreted and broke rest of the page code.

Shouldn't this control validation just work fine without the need of javascript? 

yes, it should. but if you have an error on the page you can never be sure which rules/calculations/code is in fact executed and which not


Forum|alt.badge.img+1
  • Author
  • June 25, 2018

Hi Marian, I basically deleted every single field and every single validation and rule. After checking, I had an error in a date field. It took a lot of time to check for this but I've finally fixed it, the control validation is working fine now, i think every field validation should have a try catch or something like that in order to not crash the whole page if something is wrong, and it definitely should have a better error message to check where the error was. Thank you so much for your support.