Getting Everything from a <select multiple>

Discussion in 'HTML' started by Jayenkai, Feb 15, 2004.

  1. Jayenkai

    Jayenkai Guest

    http://jnk.homedns.org/cgi-bin/formforfone1.pl

    ^^ I've finally downloaded the script I needed to move those little
    items about my 4 columns..
    But now I've stumbled across a slight problem.
    I can't actually figure out what's IN each list, without requireing
    that each list has it's items selected before the user clicks Send.

    Does anyone know how I can access the results from this page, or of
    any other alternative?
     
    Jayenkai, Feb 15, 2004
    #1
    1. Advertising

  2. Jayenkai

    Tobias Wolff Guest

    Jayenkai wrote:
    > http://jnk.homedns.org/cgi-bin/formforfone1.pl
    >
    > ^^ I've finally downloaded the script I needed to move those little
    > items about my 4 columns..
    > But now I've stumbled across a slight problem.
    > I can't actually figure out what's IN each list, without requireing
    > that each list has it's items selected before the user clicks Send.
    >
    > Does anyone know how I can access the results from this page, or of
    > any other alternative?


    You have got two alternatives:

    1. Either you remember these items you added in a javascript array, so
    that on submit you can pass these items to the target script by setting
    some hidden fields in the form.

    2. You can gather the items inside of selects by using it's "options"
    property.

    var strItems = '';
    for(intI = 0; intI < objSelect.options.length; intI++)
    {
    strItems += objSelect.options[intI].value; // or ___.text;

    if(intI < objSelect.options.length - 1)
    {
    strItems += ',';
    }
    }

    Now you have got a comma separated list of all items in the list and
    pass them to the script with a hidden field.

    Hope this helps,
    Tobias.
     
    Tobias Wolff, Feb 15, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. zetasum
    Replies:
    0
    Views:
    495
    zetasum
    Feb 18, 2005
  2. zetasum
    Replies:
    0
    Views:
    469
    zetasum
    Feb 18, 2005
  3. palmiere
    Replies:
    1
    Views:
    467
    Erwin Moller
    Feb 9, 2004
  4. Ferd Berfel
    Replies:
    4
    Views:
    169
  5. Max
    Replies:
    5
    Views:
    263
    Thomas 'PointedEars' Lahn
    Apr 14, 2008
Loading...

Share This Page