|
-
Oct 12th, 2000, 02:27 AM
#1
Thread Starter
Hyperactive Member
Hi there!
I want to select (or highlight) the item in a listbox while sending back the data to the browser, which the user has selected in the listbox before sending to the server. I am able to send back all the data to the appropriate controls except the listbox (for validation purpose). Please help me.
Either Javascript or vbscript code is ok. (and ofcourse it is a asp page)
-
Oct 12th, 2000, 09:59 AM
#2
Frenzied Member
I'm confused. HTML Listboxes behave this way by default, there is nothing to do to get it to do what you are asking...
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Oct 12th, 2000, 11:58 PM
#3
Thread Starter
Hyperactive Member
sorry!
Hi there!
I wanted to do server side validation. After requesting the data from the client, I am checking the data from the serverside and sending the data back to the client if any error found, so that the user may change it and re-send. But I don't know how to select or highlight the value (which the user has selected before sending to the server) of the listbox through code.
-
Oct 13th, 2000, 09:40 AM
#4
Frenzied Member
Use a HTML form to pass the data back to your page and put code at the beginning of your page that checks for the form data. If it's found process it, otherwise simply display the page as normal.
Code:
<HTML>
<BODY>
<FORM id=MyForm method=post action="MyPage.asp">
<SELECT id=MySelect>
<OPTION value=BLAH1>BLAH 1 BLAH</OPTION>
<OPTION value=BLAH2>BLAH 2 BLAH</OPTION>
</SELECT>
<INPUT type=Submit id=MySubmit value=Submit>
</FORM>
</BODY>
</HTML>
At the top of your page:
Code:
<%
If Request.Form("MySelect").Count > 0 Then
'{Do Something with the data here}
End If
%>
If you'd like to have the value still highlighted when the page is reloaded you can check the value in request.form against the value you are writing into the select tag (Presumably from a database) and add a 'selected' attribute if it is equal.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|