Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How can I read <select> contents on the server?

Reply
Thread Tools

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

 
 
Christina
Guest
Posts: n/a
 
      01-29-2004
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


 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      01-29-2004
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
>
>



 
Reply With Quote
 
 
 
 
Aaron Bertrand - MVP
Guest
Posts: n/a
 
      01-29-2004
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
>
>



 
Reply With Quote
 
Christina
Guest
Posts: n/a
 
      01-29-2004
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
> >
> >

>
>



 
Reply With Quote
 
Ray at
Guest
Posts: n/a
 
      01-29-2004

"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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Adding contents on yaml file without overwriting actual contents Kamarulnizam Rahim Ruby 4 01-28-2011 09:10 AM
if innerHTML used twice then it replaces the contents i want it to display all the contents virendra.amritkar@gmail.com Javascript 0 06-29-2007 08:13 AM
can't read contents of cd betteeboop Computer Support 5 09-12-2004 12:35 PM
Can I restrict both attribute contents and element contents in schema Don Adams XML 1 03-05-2004 12:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57