Skip to main content
Nintex Community Menu Bar
Solved

Reset dropdown controls by changin options in nintex 365.

  • Nov 1, 2017 11:33 PM UTC
  • 7 replies
  • 239 views
  • Translate All

Forum|alt.badge.img+6

Hello Team,

I am trying to reset a dropdown control based in a checkbox, I would like you to check my code and give me some feedbacks, I have done something similar in Nintex on-premisses but this solution is not working for nintex form 365...

 

Here is the script that I am using:

 

NWF$(document).ready(function(){ var obj = NWF$("#" +Driverc); obj.change(function(){NWF$("#" + Transporttoc).val('');} );} );

 

210279_pastedImage_3.png

The checkbox driver appear if the option "From Airport to Hotel" is selected in the dropdown, otherwise desappear.

Now what I need is: If checkbox has been selected and then the user realized that is not necesary and uncheck it, then reset the dropdown.

 

Thanks in advance

Best answer by TomaszPoszytek

Hi,

The code you provided should work in my opinion... To be sure, that the dropdown gets reset only when checkbox is unchecked, you can add a rule to be verified:

NWF$(document).ready(function () {
    NWF$("#" + Driverc).change(function () {
        if (!NWF$(this).prop('checked'))
            NWF$("#" + Transporttoc).val('');
    });
});‍‍‍‍‍‍‍‍‍‍‍‍

Alternatively you can try to clear your dropdown selection using:

NWF$("#" + Transporttoc + " option:selected").removeAttr("selected");‍‍

But I think the "val('')" is enough.

Regards,

Tomasz

View original

7 replies

TomaszPoszytek
Forum|alt.badge.img+17

Hi,

The code you provided should work in my opinion... To be sure, that the dropdown gets reset only when checkbox is unchecked, you can add a rule to be verified:

NWF$(document).ready(function () {
    NWF$("#" + Driverc).change(function () {
        if (!NWF$(this).prop('checked'))
            NWF$("#" + Transporttoc).val('');
    });
});‍‍‍‍‍‍‍‍‍‍‍‍

Alternatively you can try to clear your dropdown selection using:

NWF$("#" + Transporttoc + " option:selected").removeAttr("selected");‍‍

But I think the "val('')" is enough.

Regards,

Tomasz

Translate

Forum|alt.badge.img+6
  • Author
  • Nov 2, 2017 9:45 PM UTC

Hello ‌

Thank you for your answer,

Is weird, now i am getting the error "The App Nintex Forms for Office 365 is out of date". Please update it.

I am not sure if I need make any update or something like that... Is the first time that I run into. 

Translate

TomaszPoszytek
Forum|alt.badge.img+17

Maybe try to refresh the window. I personally haven't seen anything like that ever

regards,

Tomasz

Translate

Forum|alt.badge.img+12
  • Nov 6, 2017 11:55 PM UTC

Hello,

You'll get that error whenever something is "wrong" with the Javascript.   It is usually syntax related.

Translate

Forum|alt.badge.img+11
  • May 10, 2018 11:56 AM UTC

Hey Tomasz

How would the code look like if the checkbox is a choice instead?

I been trying to use this:

NWF$(document).ready(function()
{
var freightChoice = NWF$("#" +FreightCharges);
freightChoice.change(function()
{
NWF$("#" + showProjectNumbers + " option:selected").removeAttr("selected");
} );
} );

the FreightCharges is the choice of 4 options and I like the dropdown field (showProjectNumber) to be reset as soon as the choice options have changed. If I get this to work then I will add more fields to reset based on same principle ...

the above code, does not work  

Translate

Forum|alt.badge.img+11
  • May 10, 2018 3:01 PM UTC

UPDATE

The script works when setting "Cliend ID JavaScript variable name" to YES and referencing it!

However, the dropdown field does not default back to its original state ...

Also tried with the below code but not working:

NWF$("#" + Transporttoc + " option:selected").removeAttr("selected");

Any suggestions?

Translate

Forum|alt.badge.img+11
  • May 11, 2018 12:12 PM UTC

UPDATE:

Finally got it to work as I wanted

NWF$(document).ready(function()
{
var freightChoice = NWF$("#" +FreightCharges);
freightChoice.change(function()
{
NWF$('#'+selectProjectNumbersValue).val("");
NWF$('#'+selectProjectNumbersValue).siblings('select.nf-client-control').val('**SelectValue**');

} );
} );

This now resets the dropdown value to "Please select..." for a vLookup field.

If you have a normal dropdown field then you need to implement the following:

NWF$("#" + selectProjectNumbersValue + " option:selected").removeAttr("selected");

source: https://community.nintex.com/thread/17642-is-it-possible-to-clear-value-of-lookup-column

Translate