custom control validation

  • 12 April 2018
  • 5 replies
  • 86 views

Hi All,
I have created a custom date/time picker control for Nintex Forms. The Problem I am having with it is that the Nintex Validation doesn't seem to work on the custom control. It does not recognize a value in the input-html-element, despite there being one. Any help is appreciated.


5 replies

Userlevel 5
Badge +14

Where have you put the validation? On the Control? In a Rule? 

Can you share the contents of the validation rule itself? 

Without any additional details, it's impossible to solve the problem.

Well I tried implementing server side validation according to: Custom Control - Server Side Validation 

 

What I am trying to achieve is that the Nintex Froms rules work on my Custom Control.

For instance:

Here the Validation so far:

Here is the datetimepicker that I am trying to implement:

   Bootstrap 3 Datepicker 

What I have managed: 

  • All Date/Time picker functionality - selecting a date, format etc.
  • The Control is in the named controls in Nintex Forms
  • Input is saved correctly in Database
  • Write-back works as well

The input-html-element is wrapped in a div element with the id "datetimepicker" in order to have full functionality of the date/time picker.

I am not sure if I need to write custom javascript in my Form in order to achieve this or if this is part of the control that I then deploy as a farm solution.

When I implement a Nintex Forms rule like: 

It keeps displaying the DateTimeValidator.ErrorMessage, despite there being a date in the input-html-element.

Userlevel 5
Badge +14

My apologies. I misread your post as "Custom Validation" and missed the "Custom Control" part. 

That being said, there is some trouble shooting we can do! 

No matter what we can grab the value from the control using a custom rule, but if you'd like to see what Nintex is doing, I'd recommend using the following code in a Validation Rule

(function(formattedString){
  console.log(formattedString);
  return true;
}("Custom Date Time Control"))‍‍‍‍

I have written in the text "Custom Date Time Control", but I'd like you to actually go in and click on the 'Named Control' in the references to add the red linked value there, but just don't forget to put quotes around it so that we can see how Nintex is changing it!

Ultimately it should look like:

Before Previewing your form, press F12, and after the form has been rendered, try submitting it (the form that is) which will trigger the validation rule you setup and produce a console output similar to: 



That should at least tell you if the correct formcontrolid is being generated once you compare it to the actual html present on the form. 


Indeed it is the correct formcontrolid:

Reply