Click to Enable: Nintex Forms

Nintex Forms has awesome Conditional Validation/Formatting rules and I highly recommend taking advantage of them when building your forms, but sometimes you need validation or formatting of your form when a certain event occurs.

I was working with a customer and they had a great question of making a checkbox enable only after a user clicks on a hyperlink on the form. Awesome use case and I'll show you how it's done!

The Build

Open the Nintex Forms Designer and add one label control and one Yes/No control.

In the Yes/No control, open the configuration settings and "I clicked on Nintex!" in the Text field. Next, expand the Advanced section and change 'Store Client ID in JavaScript variable' to Yes. Enter the value 'ackBox' in the 'Store Client ID in JavaScript variable' field.

Here is what the form looks like in Design mode (I'll show you the HTML to write in the Label control in a bit).

The Code

In the label control, open up the Control settings and then click in the body of the Label Control, then click on Edit Source in the ribbon.

Enter the following HTML in the body of the Edit Source window:

<p>Please visit <a id="link" href="" target="_blank">Nintex</a> for more information!</p>

Save the HTML in the label control and also the label control settings, and then open up  Settings in the Nintex Forms Ribbon at the top of the designer.

From there , expand 'Custom JavaScript' and paste in the following code:

NWF$(document).ready(function() {
 NWF$('#' + ackBox).attr("disabled", true);
 NWF$('#link').click(function() {
 NWF$('#' + ackBox).attr("disabled", false);

Click Save to save the new Form settings and now it's time to test out your form!

Now, to prevent users from submitting the form, you can write a Validation Rule (after you add a name to the Yes/No checkbox(in this example it's named 'chkBox')) such as the following:

The Result

Notice the Yes/No control is disabled even though the link (the word 'Nintex') is purple because it's a link I have visited. This is important if a person will use this form more than once.

Now, I'll try to submit the form without checking the box either and without clicking the link.

Lastly, I'll visit the link to enable to box and check it.

Not too bad for the first real post of the year! Like always, feel free to add any comments or questions below.