Skip to main content
Nintex Community Menu Bar

Automating the selection of an item in a choice field

  • October 27, 2017
  • 2 replies
  • 22 views

Forum|alt.badge.img+4

I have a choice field where multiple items can be selected. There is one instance where if a users selects a Virtual Desktop, they also need to have Remote Access. Is it possible to automatically check Remote Access so the user does not forget that part? Here is the field:

2 replies

Forum|alt.badge.img+7
  • Nintex Partner
  • October 29, 2017

Hi,

Add a CSS class to the choice control as per the below:

Then add the below JavaScript to the form:

NWF$(document).ready(function () {
            NWF$('.ChoiceClass input[type="checkbox"]').change(function () {
                var VirtualDesktop = false;
                var RemoteAccess = false;
                NWF$('.ChoiceClass input[type="checkbox"]:checked').each(function (index, elem) {
                    if (NWF$(elem).val() == 'Virtual Desktop') {
                        VirtualDesktop = true;
                    }
                    if (NWF$(elem).val() == 'Remote Access') {
                        RemoteAccess = true;
                    }
                });
                if (VirtualDesktop && !RemoteAccess) {
                    NWF$('.ChoiceClass input[type="checkbox"][value="Remote Access"]').prop('checked', 'checked');
                }
            });
});‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Be aware of the hard coded 'Virtual Desktop' and 'Remote Access' (Double check the values please).

Enjoy and keep running on pure Nintex Adrenaline happy.png!!!


Forum|alt.badge.img+14
  • Scholar
  • October 30, 2017

if you want to avoid javascript, you could just setup a validation rule.

it will not preset choice options, but will not allow a user to submit form if the two required option are both not selected.

validation rule formula might look like

inArray(DeviceChoice,'Virtual Desktop') && not(inArray(DeviceChoice,'Remote Access'))

‌ select two options‌