cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
marp
Nintex Newbie

Select value from DD with JS

Jump to solution

Unfortunately, I am not a java/vb developer. Maybe someone could be so kind and help me? I have two DD and I want to set the second one to NULL if the value of the first DD is not NULL (“Please select a value…”). How can i solve that ...with JS? I appreciate every suggestion!

 

 

What I tried …

 

 

var hwt =document.getElementById("DD_HardwareType");

var mhl =document.getElementById("DD_MonitorHelp");

 

if (hwt.selectedIndex != 'null') {

mhl.selectedIndex = 'null';

}

 

Tia!

Labels: (1)
Tags (2)
0 Kudos
Reply
4 Replies
janeyres
Nintex Newbie

Re: Select value from DD with JS

Jump to solution

Hi,

Please can you tell me what type of field you are using as your drop-down? Is it a Choice? And is it connected to a list column?

Thanks

Jan

0 Kudos
Reply
marp
Nintex Newbie

Re: Select value from DD with JS

Jump to solution

It is a "Drop down List". Source list is Hardware_Type (DD_HardwareType) and MonitorHelp (DD_MonitorHelp). At the moment the DD is not connected to a list.

Tia!

0 Kudos
Reply
janeyres
Nintex Newbie

Re: Select value from DD with JS

Jump to solution

Thanks,

 

The following steps should get this working for you.

 

Default settings for HardwareType field in my test example (will be different for you):

Default settings for MonitorType field in my test example:

 

1. In the settings of your Hardware_Type field expand Advanced section and store the Client ID in a javascript variable called DD_HardwareType

2. In the settings of you MonitorHelp field expand the Advanced section and store the Client ID in a javascript variable called DD_MonitorHelp

3. Then in Form settings - Custom JavaScript section paste the following:

 

 

 

 

function setMonitorType(myControl) {
    var nullValue = "Please select a value...";
    if (myControl.val() != nullValue) {       
        NWF$("#" + DD_MonitorHelp).val(nullValue);
    }
}

NWF.FormFiller.Events.RegisterAfterReady(function () {
    NWF$("#" + DD_HardwareType).on("change", function (event) { setMonitorType(NWF$(this)); });
});

0 Kudos
Reply
marp
Nintex Newbie

Re: Select value from DD with JS

Jump to solution

Works perfectly! Thank you!

0 Kudos
Reply