473,231 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Select's Qusetion

Hello,
<%@ Language=VBScript %>
<%
Response.Write "<FORM name=form1>"
Response.Write "<select name=""select1"">"
Response.Write "<option value=1>One</option>"
Response.Write "<option value=2>Two</option>"
Response.Write "<option value=3>Three</option>"
Response.Write "</select>"
Response.Write "</FORM>"
%>
I want when select1's value change,run a server-side function.
Thank you

Jul 19 '05 #1
6 1317
You'll need to submit a form or invoke the server in some way. Client-side
script does not know what the server is; it is merely running code on the
client.

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


"Jack" <si*****************@noyahoo.co.jp> wrote in message
news:O4**************@TK2MSFTNGP12.phx.gbl...
Hello,
<%@ Language=VBScript %>
<%
Response.Write "<FORM name=form1>"
Response.Write "<select name=""select1"">"
Response.Write "<option value=1>One</option>"
Response.Write "<option value=2>Two</option>"
Response.Write "<option value=3>Three</option>"
Response.Write "</select>"
Response.Write "</FORM>"
%>
I want when select1's value change,run a server-side function.
Thank you

Jul 19 '05 #2
I think you'd have a much easier time differentiating between server side
and client side code/html if you were to break out of the Response.Write
habit for all your straight-up HTML. Drop the ASP'ing out of this
altogether.
<%
''your asp code
%>

<FORM name=form1>
<select name="select1">
<option value=1>One</option>
<option value=2>Two</option>
<option value=3>Three</option>
</select>
</FORM>
See, there's no ASP code there.

Ray at home


"Jack" <si*****************@noyahoo.co.jp> wrote in message
news:O4**************@TK2MSFTNGP12.phx.gbl...
Hello,
<%@ Language=VBScript %>
<%
Response.Write "<FORM name=form1>"
Response.Write "<select name=""select1"">"
Response.Write "<option value=1>One</option>"
Response.Write "<option value=2>Two</option>"
Response.Write "<option value=3>Three</option>"
Response.Write "</select>"
Response.Write "</FORM>"
%>
I want when select1's value change,run a server-side function.
Thank you

Jul 19 '05 #3
<%
Dim theAction: theAction = Request.QueryString("select1")

With Response
Dim optionsArray, zArray, activeOption
optionsArray = Split("0#Select
Action@@1#One@@2#Two@@3#Three", "@@")

.Write "<FORM name=""form1"" type=""get"" action=""?"">"

.Write "<select name=""select1""
onChange=""document.form1.submit()"">"
For n = 0 to ubound(optionsArray)
zArray = Split(optionsArray(n), "#")
activeOption = ""
If theAction = zArray(0) Then: activeOption = "
selected"
.Write "<option value=""" & zArray(0) & """" &
activeOption & ">" & zArray(1) & "</option>"
Next
.Write "</select>"
.Write "</FORM>"
End With

Select Case Request.QueryString("action")
Case "1"
'// some function
Case "2"
'// some function
Case "3"
'// some function
Case Else
'// NO ACTION
End Select
%>

Brynn
www.coolpier.com

On Mon, 19 Jan 2004 09:48:04 +0900, "Jack"
<si*****************@noyahoo.co.jp> wrote:
Hello,
<%@ Language=VBScript %>
<%
Response.Write "<FORM name=form1>"
Response.Write "<select name=""select1"">"
Response.Write "<option value=1>One</option>"
Response.Write "<option value=2>Two</option>"
Response.Write "<option value=3>Three</option>"
Response.Write "</select>"
Response.Write "</FORM>"
%>
I want when select1's value change,run a server-side function.
Thank you


I participate in the group to help give examples of code. I do not guarantee the effects of any code posted. Test all code before use!

Brynn
www.coolpier.com
Jul 19 '05 #4
Thank you very much,but how can submit form1 when changing select1's value?
<FORM name=form1>
<select name="select1">
<option value=1>One</option>
<option value=2>Two</option>
<option value=3>Three</option>
</select>
</FORM>
I wait anyone's help

Jul 19 '05 #5

Look at my answer in the last post ... this is client-side code.

<select name="select1" onChange="document.form1.submit()">

my code is fully fuctioning ... you can put in a blank page and see it
work ... it even keeps track of which select you are on.

Brynn

On Mon, 19 Jan 2004 13:03:02 +0900, "Jack"
<si*****************@noyahoo.co.jp> wrote:
Thank you very much,but how can submit form1 when changing select1's value?
<FORM name=form1>
<select name="select1">
<option value=1>One</option>
<option value=2>Two</option>
<option value=3>Three</option>
</select>
</FORM>
I wait anyone's help


I participate in the group to help give examples of code. I do not guarantee the effects of any code posted. Test all code before use!

Brynn
www.coolpier.com
Jul 19 '05 #6
Thank you very much

Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: JT | last post by:
I have an input form for which I've created a "matrix" for user input. Basically, the user chooses a radio button and then through javascript, a select box is displayed to define a value for that...
21
by: John Fabiani | last post by:
Hi, I'm a newbie and I'm attempting to learn howto create a select statement. When I use >>> string1='18 Tadlock Place' >>> cursor.execute("SELECT * FROM mytest where address = %s",string1) All...
3
by: Memduh Durmaz | last post by:
Hi, I'm using DB2 UDB 7.2. Also I'm doing some tests on SQL Server 2000 for some statements to use efectively. I didn't find any solution on Sql Server about WITH ... SELECT structure of DB2. ...
4
by: point | last post by:
Hello there... I'm a PHP programmer and starting to learn JS... I have a following problem.... I have 3 select boxes! one is hotel one is destination and one is country... if someone...
1
by: Carl Wu | last post by:
Hi all, I am newcomer in HTML, Javascript, I want to create two select controls S1, S2. There are 3 options: ALL, A, B in S1; When select A in S1, It let you select A1, A2 in S2,
18
by: CJM | last post by:
I'm building a search function for one of my applications. The user has the option to enter a number criteria of criteria, but none are compulsary. I need to be able to build up a query string that...
10
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I...
1
by: serena.delossantos | last post by:
Trying to insert into a history table. Some columns will come from parameters sent to the store procedure. Other columns will be filled with a separate select statement. I've tried storing the...
6
by: Apaxe | last post by:
In the database i have a table with this information: key_id =1 key_desc =43+34+22+12 I want sum the values in key_desc. Something like: SELECT key_desc FROM table But the result of...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.