How can I read <select> contents on the server?

Discussion in 'ASP General' started by Christina, Jan 29, 2004.

  1. Christina

    Christina Guest

    I want to read a classic HTML Form using the ASP Request object on the
    server. This is a common approach. But how can I read all the contents of a
    listbox (the <select> tag)?


    Best regards,
    Christina
    Christina, Jan 29, 2004
    #1
    1. Advertising

  2. Christina

    Ray at Guest

    When the form is posted, the only data that is passed from the <select> is
    what is selected. Options:

    Use client side script to select all the elements onsubmit. (not 100%
    reliable)

    If your select is generated by your ASP code, use the same logic to
    regenerate the list again. If this is not an option, use a hidden input(s)
    and have it contain the same data that is in the <select>.

    Ray at work

    "Christina" <> wrote in message
    news:...
    > I want to read a classic HTML Form using the ASP Request object on the
    > server. This is a common approach. But how can I read all the contents of

    a
    > listbox (the <select> tag)?
    >
    >
    > Best regards,
    > Christina
    >
    >
    Ray at, Jan 29, 2004
    #2
    1. Advertising

  3. You could put all the contents of the <select> in a hidden input type.
    However, how are you building the <select> list? Isn't it static? If so,
    you don't need to read it every time a user submits a form.

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/




    "Christina" <> wrote in message
    news:...
    > I want to read a classic HTML Form using the ASP Request object on the
    > server. This is a common approach. But how can I read all the contents of

    a
    > listbox (the <select> tag)?
    >
    >
    > Best regards,
    > Christina
    >
    >
    Aaron Bertrand - MVP, Jan 29, 2004
    #3
  4. Christina

    Christina Guest

    How do I select the elements on exit? And how do I read them on the server?

    The form is submitted by the user after he/she has modified the contents of
    the listbox (by adding items from another listbox)


    Best ones,
    Christina



    "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:...
    > When the form is posted, the only data that is passed from the <select> is
    > what is selected. Options:
    >
    > Use client side script to select all the elements onsubmit. (not 100%
    > reliable)
    >
    > If your select is generated by your ASP code, use the same logic to
    > regenerate the list again. If this is not an option, use a hidden

    input(s)
    > and have it contain the same data that is in the <select>.
    >
    > Ray at work
    >
    > "Christina" <> wrote in message
    > news:...
    > > I want to read a classic HTML Form using the ASP Request object on the
    > > server. This is a common approach. But how can I read all the contents

    of
    > a
    > > listbox (the <select> tag)?
    > >
    > >
    > > Best regards,
    > > Christina
    > >
    > >

    >
    >
    Christina, Jan 29, 2004
    #4
  5. Christina

    Ray at Guest

    "Christina" <> wrote in message
    news:...
    > How do I select the elements on exit?


    This I am not sure about. Try inquiring in a javascript group. I believe
    you have to loop through all the options and mark them as selected.

    > And how do I read them on the server?


    theVals = Request.Form("TheNameOfTheSelect")


    >
    > The form is submitted by the user after he/she has modified the contents

    of
    > the listbox (by adding items from another listbox)


    I see. Then, well, that at least tells you that the user's browser supports
    javascript, so I'd go either do the "select all on submit" or possibly
    better, add something to the same client-side function that is entering the
    new values in the select that will also add the values to a hidden input.

    Ray at work
    Ray at, Jan 29, 2004
    #5
    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. Doug
    Replies:
    3
    Views:
    4,352
    Bruce Barker
    Nov 4, 2005
  2. Don Adams
    Replies:
    1
    Views:
    581
    Martin Honnen
    Mar 5, 2004
  3. Kamarulnizam Rahim
    Replies:
    4
    Views:
    204
    Robert Klemme
    Jan 28, 2011
  4. Dan Thomas
    Replies:
    0
    Views:
    270
    Dan Thomas
    Feb 2, 2011
  5. palmiere
    Replies:
    1
    Views:
    386
    Erwin Moller
    Feb 9, 2004
Loading...

Share This Page