Changing list lookup dropdown selection based on yes/no value


Badge +1

I'm having trouble with my getting my Nintex form list lookup dropdown to behave how I want it to. I'm very new to both Nintex and javascript, so please excuse me if I use the wrong terms or miss out important information.

I have a list lookup dropdown control on my form that is linked to a column in a separate list I've produced in SharePoint 2013. It displays the contents of that list just fine, and lets you pick any entry. I also have a yes/no control on the form. When the yes/no control is checked, I want the list lookup dropdown entry to change from whatever was previous selected to the entry 'n/a' (which is ID1).

The list look up dropdown control is called 'Shipping Terms DD', has 'Store Client ID in JavaScript variable' set to 'yes', and a 'Client ID JavaScript variable name' of 'ddlShipTerms'.

The yes/no control is called 'chkboxYes', has 'Store Client ID in JavaScript variable' set to 'yes', and a 'Client ID JavaScript variable name' of 'varcheckboxYes'.

The form itself has the following Custom JavaScript enabled:

NWF$("#"+varcheckboxYes).click(function(){
if(NWF$(this).prop("checked")){
NWF$("#"+ddlShipTerms).val('1');
}
});

Ticking the yes/no control does not achieve anything. Nothing changes in the dropdown. Can anyone please tell me where I'm going wrong?

Many thanks, in advance.


4 replies

Badge +7

Hi,

Change to :

NWF$("#"+varcheckboxYes).change(function(){
if(NWF$(this).prop("checked")){
NWF$("#"+ddlShipTerms).val('1');

NWF.FormFiller.Functions.ProcessOnChange(NWF$("#"+ddlShipTerms));
}
});

You ca use as well

NWF$(this).is(":checked") instead of  NWF$(this).prop("checked")

BR,
Philip

Badge +1

Thank you for the suggestion, but I've just tried all variants of the code you've provided, and the DDL choice still isn't updating.

I've added the following lines to the form Custom JavaScript as a test:

NWF$(document).ready(function() {
NWF$("#"+ddlShipTerms).val('1');
});

This sets the default value in the DDL just fine, so I'm confident the naming convention is set up correctly, but for whatever reason I cannot seem to get the DDL to change as the result of a button press or yes/no toggle.

Have you tried the code you suggested yourself, and if so did it work for you? I would be interested to know if it is just me...

Badge +7

Send me the form please.

Badge +1

‌ I've messaged you separately about this as I don't think I have the ability to add attachments on this forum?

Reply