Select OnAction in ASP?

J

Johan Christensson

Hi.

I'm woundering if it's possibel to transfer a OnAction value from a
drop-down box in an ASP page without having to use Java code?

I mean something like this:

<%

Sub resposeprocess
some code,......
End Sub

%>

<Select name="DropDownMenu onAction="responseprocess">
<Option value="1">Value 1</option>
<Option value="2">Value 2</option>
</Select>

Can i get holds of the value from the drop-down box and use it inte the
subroutibe?

/Johan Ch
 
R

Ray Costanzo [MVP]

No, not really. See, with the way ASP works, there is no "built-in" way to
interact between client and server. How things work is:


1. Browser enters URL, which in turn sends an http request to a server.
2. Server receives request, loads the page, runs any ASP code that may be
in it.
3. After all the code is run or a Response.End is reached, the resultant
HTML is sent back to the client (browser) that made the request.

So, you see, by the time your onAction (what's that?) event happens, there
is no server sitting there connected to the browser waiting for a subroutine
call. You have to have the browser make another request to the server. For
example:



<%
If Request.Querystring("choice") <> "" Then Call resposeprocess()
Sub resposeprocess()
''some code
Response.Write "Sub routine ran."
Response.Write "<br>Option chosen: " & Request.Querystring("choice")
End Sub
%>

<select name="DropDownMenu"
onchange="location.href='thispage.asp?choice='+this.value;">
<option value="1">Value 1</option>
<option value="2">Value 2</option>
</select

So, that's using JavaSCRIPT, which you didn't want to do, but you either
have to use that or encapsulate this in a form with a submit button that the
user will have to click on to send the new request to the server.

Ray at home
 
J

Jeff Cochran

I'm woundering if it's possibel to transfer a OnAction value from a
drop-down box in an ASP page without having to use Java code?

Sure. It could be JavaScript, ActiveX or anything else tht will
operate on the client side. :)
I mean something like this:

<%

Sub resposeprocess
some code,......
End Sub

%>

<Select name="DropDownMenu onAction="responseprocess">
<Option value="1">Value 1</option>
<Option value="2">Value 2</option>
</Select>

Can i get holds of the value from the drop-down box and use it inte the
subroutibe?

No. The ASP page is processed and sent to the client. Then the
client changes something. The ASP is done, so the client has to
trigger sending something to the server. Which means some type of
client side code, be it Java, JavaScript, ActiveX or a "Submit"
button.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top