Request.form(listbox)

Discussion in 'ASP General' started by Mark Tait, Sep 2, 2003.

  1. Mark Tait

    Mark Tait Guest

    Hi - I'm using the function below, to add items from one list box, to
    another - however, when I post the page back to iteself (ASP) and do a
    request.form, it does not pick up any items in the second list - because
    they're not hilighted when the page is posted.

    Is there a way of picking up the items in the list, regardless of
    whether they are selected ot not?

    Thanks for any help, Mark



    <SCRIPT LANGUAGE="JavaScript">
    <!--

    function Populate() {
    frm=document.forms[0]
    field1=frm.txtaddresslist
    field2=frm.txtmemb

    for(i=0, j=0;i<field1.length;i++) {
    if(field1.options.selected) {
    newOpt=field1.options.text
    // a=field2.length
    // alert(a)
    // field2.length++
    alert(field2.length)
    a=field2.length
    field2.options[a]= new Option(newOpt,newOpt)
    j++
    }
    }
    }

    // -->
    </SCRIPT>

    Mark Tait

    www.fixitks.co.uk

    Mark Tait

    www.fixitks.co.uk

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Mark Tait, Sep 2, 2003
    #1
    1. Advertising

  2. Mark Tait

    Bob Barrows Guest

    Mark Tait wrote:
    > Hi - I'm using the function below, to add items from one list box, to
    > another - however, when I post the page back to iteself (ASP) and do a
    > request.form, it does not pick up any items in the second list -
    > because they're not hilighted when the page is posted.
    >
    > Is there a way of picking up the items in the list, regardless of
    > whether they are selected ot not?
    >

    No. The only data submitted by a form is data that is entered or selected by
    the user. If the responding page needs to know all the items in the list,
    you have to supply them either in the responding page, or use a hidden
    textbox in the form that contains all the items. Hey! you could create a
    hidden copy of the listbox that has all the values selected! Try that.

    Bob Barrows
     
    Bob Barrows, Sep 2, 2003
    #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. blenderdude
    Replies:
    0
    Views:
    1,128
    blenderdude
    Aug 3, 2003
  2. Brian Birtle
    Replies:
    2
    Views:
    2,139
    John Saunders
    Oct 16, 2003
  3. DC Gringo
    Replies:
    0
    Views:
    418
    DC Gringo
    Apr 6, 2004
  4. kent
    Replies:
    1
    Views:
    900
    Andrew de la Harpe
    May 3, 2004
  5. Mr Newbie

    Listbox does not appear in Request.Form

    Mr Newbie, Sep 23, 2005, in forum: ASP .Net
    Replies:
    10
    Views:
    4,767
    Mr Newbie
    Sep 23, 2005
Loading...

Share This Page