Click to See Complete Forum and Search --> : asp msgbox syntax problem


Johntoel
08-21-2006, 01:00 AM
<%
dim m
m = 1
Response.Write "<script language=""vbscript""> select case MsgBox("" You have been"" & CHR(10) & "" informed!"", vbInformation + vbOkOnly + vbDefaultButton,"" Info"")"&CHR(10)
Response.Write "case vbOK "&"document.location=""yes.asp?id1="&m""" &CHR(10)
Response.Write " end select " & CHR(10) & "</script>"
%>

I have a syntax problem to pass the value of m to yes.asp. Appreciate if someone can help with the correct syntax. Thank's

vanny
08-21-2006, 02:10 AM
Is there any reason you are not using Javascript on the client side. This is the more accepted and portable method?

Johntoel
08-21-2006, 03:58 AM
Hi, this is a server side script for displaying msgbox that requires an 'ok' click to redirect to another page, however i need to pass a parameter to that page. That's where I am stuck with the syntax as the value of var. m can't be passed to the next page.

russell
08-21-2006, 08:50 AM
<script language="vbscript">
dim m
m = 1
select case MsgBox(" You have been" & CHR(10) & " informed!", vbInformation + vbOkOnly + vbDefaultButton," Info")
case vbOK document.location="yes.asp?id1="&m
end select
</script>

Johntoel
08-21-2006, 09:44 AM
the above line 'Response.Write "case vbOK "&"document.location=""yes.asp?id1="&m""" &CHR(10)' is a syntax error. I want to the user directed to i.e.:
'http://localhost/mysite/yes.asp?id1=1'
but I don't know how to write ...id1=m
Thank's for trying...

russell
08-21-2006, 10:22 AM
did u try the script i posted? it doesn't have the error u are saying. end the asp script tag for the script block...

<%
'' asp code here, then we'll close asp tag to write next few lines
%>
<script language="vbscript">
dim m
m = 1
select case MsgBox(" You have been" & CHR(10) & " informed!", vbInformation + vbOkOnly + vbDefaultButton," Info")
case vbOK document.location="yes.asp?id1="&m
end select
</script>
<%
'' more asp here...
%>

Johntoel
08-21-2006, 11:22 AM
aha, thank's Russell, yes, that's just what I want.

vanny
08-21-2006, 06:57 PM
I understand that its a server side script, but you are seeing the response on the client (in a web page). Correct?

russell
08-21-2006, 09:42 PM
it's a client side vbScript. that's what his problem was -- trying to mix the 2

vanny
08-22-2006, 01:08 AM
I thought so. Ive always steered clear of client side VB to many compatability issues.

Johntoel
08-22-2006, 09:35 PM
Thank's for the info, since I am new in asp I am wondering whether there are other ways to display server script Msgbox or alert function that waits for user confirmation to continue with further processing. Thank's again