Not applicable

Custom Control - Server Side Validation

Hi Everyone,

We utilize a custom Employee Number + PIN validation for several different sign offs, and we need to incorporate this into our Nintex Forms.

We were successful in creating the custom control that is one single control with two fields by default: one field for the Employee Number and one for the PIN (picture of this attached).  Our main problem is figuring out how to validate this control (using our web service) and display a custom error message to our users.

We need to do this on the server side code and not with javascript or inline/runtime fuctions in order to avoid the possibility of using developer tools to get around the validation and submit the form without proper authentication of the PIN.

Here is what we have done so far:

  • Created a new control type using this guide:
  • Had it output two textboxes instead of just one so that we can accept two values (one for Employee #, one for PIN)
  • Tried to cancel submission of the form by throwing different types of Exceptions (regular Exception, a few Nintex defined exceptions)
  • Tried to add a validator on the CustomValidator property of the control
    • This is something that’s part of Nintex’s codebase
    • Couldn’t find any way of cancelling submission of the form gracefully

The crux of the issue is just getting the submission to stop and providing the proper error message. The two textboxes don’t have any impact on this either.

Any help is much appreciated!  Thank you.

1 Reply

Re: Custom Control - Server Side Validation

Hi Amy Thompson​!

I just figured out how to achieve this: you have to insert a CustomValidator control in addition to your textbox(es), and  implement the ServerValidate event.

Something like this:

protected override void CreateFormControls()        


TaxNumberTextBox = new TextBox();            

TaxNumberTextBox.ID = "TaxNumberTextBox";            

TaxNumberTextBox.Text = String.Empty;            


TaxNumberValidator = new CustomValidator();            

TaxNumberValidator.ControlToValidate = TaxNumberTextBox.ID;            

TaxNumberValidator.ServerValidate += Validator_ServerValidate;            

TaxNumberValidator.ErrorMessage = this.ControlSpecificProperties.ValidationErrorMessage;

TaxNumberValidator.Display = ValidatorDisplay.None;            

TaxNumberValidator.ValidationGroup = this.FormValidationGroup;            



void Validator_ServerValidate(object source, ServerValidateEventArgs args)        


args.IsValid = args.Value != "1"; // logic should be implemented here        


Hope it helps.