Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile JS array population for a Drop-Down (basic)

    So, I'm working with Adobe LiveCycle Designer which allows for programming with JavaScript. I'm not knowledgeable in the language, but I've been picking up things here and there.

    I don't know how programming in LiveCycle is different from programming for the web. Hopefully this question will make sense here too.


    I'm trying to populate a drop-down with a simple array of numbers, but I don't know how to make the array function work.

    ex:

    DropDown1 = Apple
    DropDown2 = 1-20
    DropDown1 = Orange
    DropDown2 = 1-15

    I'm using something like this:

    Code:
    if (this.rawValue == "apple") { 
    DropDown2.addItem(new Array(20)); 
    if (this.rawValue == "orange") { 
    DropDown2.addItem(new Array(15));
    Everything between

    if (this.rawValue == "apple") {
    DropDown2.addItem(

    is right, but I don't know how to make the array work. Obviously something is missing, and I sure don't know what.
    Is there a simple way where the array can populate itself?

    Thanks so much!
    Alan

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Torvik View Post
    So, I'm working with Adobe LiveCycle Designer which allows for programming with JavaScript. I'm not knowledgeable in the language, but I've been picking up things here and there.

    I don't know how programming in LiveCycle is different from programming for the web. Hopefully this question will make sense here too.
    Is first time I heard about LiveCycle, so I don't know if that works but you can try since from what I read about it suport javscript,

    I'm trying to populate a drop-down with a simple array of numbers, but I don't know how to make the array function work.

    ex:

    DropDown1 = Apple
    DropDown2 = 1-20
    DropDown1 = Orange
    DropDown2 = 1-15

    I'm using something like this:

    Code:
    if (this.rawValue == "apple") { 
    DropDown2.addItem(new Array(20)); 
    if (this.rawValue == "orange") { 
    DropDown2.addItem(new Array(15));
    Everything between

    if (this.rawValue == "apple") {
    DropDown2.addItem(

    is right, but I don't know how to make the array work. Obviously something is missing, and I sure don't know what.
    Is there a simple way where the array can populate itself?

    Thanks so much!
    Alan
    f (this.rawValue == "apple") {
    myapple = new Array(20);
    for(i = 1; i<= 20; i++){
    myapple[i] = i;
    }
    DropDown2.addItem(myapple);
    }
    [/code]

    same thing for orange,

    I hope this help you

    best regards
    Last edited by oesxyl; 12-29-2007 at 01:43 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •