Here is a quick and simple way to have a Nintex form character limit when your user input text in your text fields. This works great for Comment textboxes, input textboxes, or surveys.
The Nintex form has an option to use custom JavaScript validation. To set a Nintex form character limit, open the item Control Settings panel. From there we will need to first add CSS Control classes (I also added a general CSS class) to our Multi Line or Single Line Textbox.
Add the option to use custom Validation in the item settings. We also need to set the name of the JavaScript ‘Custom validation function‘ name and the error message.
After that is done, open the Form Settings and navigate to the Custom JavaScript section. This is where the rules about what is valid versus not valid is controlled with JavaScript. The Nintex form character limit is set by using the Nintex Workflow arguments and referencing the appropriate textbox value.
Once you have the script added to the Form Setting, go ahead and test the new Nintex form character limit within the preview panel.
Multiline Textbox
To use a Multi Line Textbox with a Nintex form character limit, give this a try.
function charCount(source, args){ var words = NWF$('.charCountBox p').text(); if(words.length > 5) { args.IsValid = false; } }
This will grab the text within the text box and count the amount of characters. In this exampled, I am limiting to 5 characters.
Single Line Textbox
If you’re looking at a Single Line Textbox for a Nintex form character limit, this should do the trick.
function charCount(source, args){ var words = NWF$('.charCountBox input').val(); if(words.length > 5) { args.IsValid = false; } }
Similar to the Multi Line except we are grabbing the value of the input box instead of the text. We then check to see if there are more than 5 characters.
Reference