473,666 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select's Qusetion

Hello,
<%@ Language=VBScri pt %>
<%
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 1336
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.c o.jp> wrote in message
news:O4******** ******@TK2MSFTN GP12.phx.gbl...
Hello,
<%@ Language=VBScri pt %>
<%
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.c o.jp> wrote in message
news:O4******** ******@TK2MSFTN GP12.phx.gbl...
Hello,
<%@ Language=VBScri pt %>
<%
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.QuerySt ring("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=""docu ment.form1.subm it()"">"
For n = 0 to ubound(optionsA rray)
zArray = Split(optionsAr ray(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.QuerySt ring("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.c o.jp> wrote:
Hello,
<%@ Language=VBScri pt %>
<%
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="docum ent.form1.submi t()">

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.c o.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
5242
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 radio option, like so: Choice: (Radio1) type: (select box1) Choice: (Radio1) type: (select box2) Choice: (Radio1) type: (select box3) Choice: (Radio1) type: (select box4) Choice: (Radio1) type: (select box5)
21
5245
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 works as expected. But >>> numb=10 >>> cursor.execute("SELECT * FROM mytest where clientID = %d",numb) Traceback (innermost last): File "<stdin>", line 1, in ?
3
8097
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. Is there any basic structure on Sql Server like WITH ... SELECT structure?
4
6431
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 clicks selects the country then the destination select box shows the destinations in that country and further if he chooses destination all
1
5512
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
4047
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 includes only the right criteria. The simplest way I have found is something like this: sSQL = "Select field1, field2, etc form table where 1=1" If Request.Form("Criteria1") <> "" then sSQL = sSQL & " and criteria1 = " &...
10
5616
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 create a single View and specify also in this View the WHERE clause that is common in these stored procedures, I will have the new stored procecures changed to be like:
1
2966
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 select return in a cursor, tried setting the values for each field with a separate select. Think I've just got the syntax wrong. Here's one of my attempts: use ESBAOffsets go
6
3392
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 the select was "111" and not "43+34+22+12".
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8355
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6191
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1769
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.