Quantcast
Channel: Adobe Community : All Content - LiveCycle Designer
Viewing all articles
Browse latest Browse all 5571

JS script to find a string in a set

$
0
0

I have a large list of items in a drop down ~30. Based on the selection I need to generate some options. I can do this several ways but figure there has to be a better way.

 

My first thought is:

var a = dropdownList1.rawValue

if (a == "Option1" || a == "Option2" || etc){

then do something

}

else

if(a == "Category1" || a== "Category2" etc){

then do something else

}

 

I can also use a case statement but cannot find a way to say:

case "Option1" || "Option 2"

 

This would leave me with

case "Option1

this.rawValue = ??

break

case "Option 2

 

There has to be a better way. I am thinking I could use an array but not sure what the syntax would be


Viewing all articles
Browse latest Browse all 5571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>