Solved

JS Code Error - For rendering a value after a drop down option is selected.

  • 14 July 2021
  • 1 reply
  • 127 views

Badge +3

I need some assistance in seeing what I am doing wrong  with the following JS.  I got the script form another post but can not seem to get it to work.

I have two cascading drop downs (lookups).  I need to populate the second dropdown based off the first drop down selection.

Fields:

  • Drop Down 1:  Areas (there are 11 selections)
    • set a form variable for this field:  jsDDA_Area
  • Drop Down 2:  Unit (is filtered to only display the corresponding choices based of drop down 1)
    • set a form variable for this field: jsDDB_Unit

 

From drop down 1 there are two selections that will filter drop down 2 with the choice N/A.  I would like that when either of those two selections are selected form "Drop Down 1" that Drop Down 2  will auto populate with the choice N/A.

I have tried the following JS script.

 

NWF.FormFiller.Events.RegisterAfterReady(function()

{NWF$('#'+jsDDA_Area).change(function(evt)

{switch(evt.target.value){case 'Operations Labs (Polymers Technology) AL-RBB': NWF$('#'=jsDDB_Unit).val('N/A'); 

break; case 'Operations Labs (PTL Bldg.)': NWF$('#'+jsDDB_Unit).val('N/A');

break; default:    //no Area  NWF$('#'+jsDDB_Unit).val('');

break; }    })})

 

I am not sure if I am not setting up the variables correctly or if I am not able to use this type of script with Lookup fields.

 

Your guidance is greatly apprecited.

 

 

icon

Best answer by kchaluvadi 15 July 2021, 01:59

View original

1 reply

Userlevel 3
Badge +12

Hi,


You can acheive this without script also, here is the link for reference, it also has a video on how to configure for cascading drop downs, not sure if you have a different requirement.

Reply