Reset Dropdown list using JavaScript

  • 29 January 2019
  • 3 replies
  • 11 views

Badge +1

In Nintex 2013 form, I want to use a button using JavaScript to reset several dropdown lists containing corporate departments.  I have searched for examples but nothing works.


3 replies

Badge +7

To reset a drop down control with a button, you can use the following process:

Form Layout:

222755_pastedImage_1.png

Choice Control Settings:

222756_pastedImage_2.png

Button Control Settings:

222757_pastedImage_6.png

JavaScript Code in Form Settings:

222758_pastedImage_8.png

Code:

function ddClear() {
NWF$('.ddClass').val('**SelectValue**');
}

End Result when Button is Clicked:

222759_pastedImage_9.png

Explanation:

Since the code is using a CSS class (ddClass), you can apply that same class to all drop down controls and they will all clear at the same time when the button is clicked once.

Badge +7

As long as the other drop downs do not have the Control CSS Class of ddClass set (see below), they won't be affected by the Clear Button.
222760_pastedImage_2.png

Simply leave that field blank on the drop downs you don't want cleared.

Badge +1

Thank you this does work perfectly, once I put the ddclass only in the dropdown lists I need cleared.

Reply