Vaneza
Forms Fledgling

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

Jump to solution

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.

 

 

0 Kudos
Reply
1 Reply
kchaluvadi
Workflow Veteran

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

Jump to solution

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.

View solution in original post

Reply