Copy link to clipboard
Copied
Hello,
I'm am still very new to coding in general, so the following issue is pretty much due to inexperience and lack of coding knowledge. What I am trying to do is cycle through the items inside of a dropdown box using a button. The plan was to have 2 buttons, one for cycling up through the items and one to cycle down, the dropbox would consist of numbers and I would simply click one of the 2 buttons "up" or "down" inorder to get the corresponding number in the list. Would this be possible through javascript? If so, how would I go about doing so?
I've been soaking up all kinds of coding information, however I haven't figured out the code value for the items inside of the Dropbox inorder to tell the buttons to cycle through the list/values
Copy link to clipboard
Copied
Hi,
that's quite easy to do. Given your drop down is named DDL it ca be don this way:
// Select lower drop down item
var d = this.getField("DDL"),
i = d.currentValueIndices;
if (i > 0) {
d.currentValueIndices = i - 1;
}
// Select upper drop down item
var d = this.getField("DDL"),
i = d.currentValueIndices,
n = d.numItems;
if (i < n-1) {
d.currentValueIndices = i + 1;
}
Copy link to clipboard
Copied
Hi,
that's quite easy to do. Given your drop down is named DDL it ca be don this way:
// Select lower drop down item
var d = this.getField("DDL"),
i = d.currentValueIndices;
if (i > 0) {
d.currentValueIndices = i - 1;
}
// Select upper drop down item
var d = this.getField("DDL"),
i = d.currentValueIndices,
n = d.numItems;
if (i < n-1) {
d.currentValueIndices = i + 1;
}
Copy link to clipboard
Copied
Thank you very much!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more