By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,078 Members | 2,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,078 IT Pros & Developers. It's quick & easy.

Select OnAction in ASP?

P: n/a
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
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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='+thi s.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

"Johan Christensson" <jo****************@telia.com> wrote in message
news:OF*************@TK2MSFTNGP14.phx.gbl...
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

Jul 19 '05 #2

P: n/a
On Wed, 29 Sep 2004 02:20:18 +0200, "Johan Christensson"
<jo****************@telia.com> wrote:
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
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.