Skip to main content
Participant
February 22, 2016
Question

How to use a switch case function to reference options that is used numerous times in the previous drop-down?

  • February 22, 2016
  • 1 reply
  • 935 views

I am using Java Coding in LiveCycle and developing dependent drop-down boxes but I am having difficulty writing the correct code. See example below. I am trying to use a multiple case function that references an option that is listed numerous times in the previous drop-down. The problem that I am running into is that when I reference Chevy or Nissan and any color, it is returning the results of the color under the "Ford" column only. I will still see the color options (Blue, Black, Green and Purple) in my second drop down and it looks fine, but then the third drop-down only references "Ford" colors and options. (I did not list the code for the third drop-down).

I want the customer to choose Chevy or Nissan and then have its dependent drop downs (based on the color they chose), but I cannot seem to make this work.

I hope this is clear enough (probably as mud…). I would greatly appreciate any help!!

form1.#subform[0].#subform[1].cboModels::exit - (JavaScript, client) 
cboColor.clearItems(); 
switch(this.rawValue){ 
case "Ford": 
  cboColor.addItem("Blue"); 
  cboColor.addItem("Black"); 
  cboColor.addItem("Green"); 
  cboColor.addItem("Purple"); 
  break; 

case "Chevy": 
  cboColor.addItem("Blue"); 
  cboColor.addItem("Black"); 
  cboColor.addItem("Green"); 
  cboColor.addItem("Purple"); 
  break; 

case "Nissan": 
  cboColor.addItem("Blue"); 
  cboColor.addItem("Black"); 
  cboColor.addItem("Green"); 
  cboColor.addItem("Purple"); 
  break; 



form1.#subform[0].#subform[1].cboColor::exit - (JavaScript, client)
cboPrice.clearItems(); 
switch(this.rawValue){ 
  case "Ford": 
  case "Green": 
  cboPrice.addItem("blah"); 
  cboPrice.addItem("blah"); 
  cboPrice.addItem("blah"); 
  cboPrice.addItem("blah"); 
  break; 

  case "Chevy": 
  case "Green": 
  cboPrice.addItem("blah"); 
  cboPrice.addItem("blah"); 
  cboPrice.addItem("blah"); 
  cboPrice.addItem("blah"); 
  break; 

  case "Nissan": 
  case "Green": 
  cboPrice.addItem("blah"); 
  cboPrice.addItem("blah"); 
  cboPrice.addItem("blah"); 
  cboPrice.addItem("blah"); 
  break; 

This topic has been closed for replies.

1 reply

Rob Hecker2
Legend
February 23, 2016

I am using Java Coding

Java and Javascript are two different computer languages. You are using javascript.

I did some javascript coding in acrobat 13 years ago but would be no help with your issue today.

Did you try the Adobe LiveCycle forum? (I hope they didn't send you here from there). That forum seems like the right place to get help for this.

Participant
February 24, 2016

Rob,

Good morning. I have not tried that forum yet (I wasn't sure which forum to post my questions to). Thank you for your help.