PDA

View Full Version : Message Box


ldiuf
09-19-2002, 03:24 PM
Ok, Can someone also show me what I did wrong with this too?

Dim MyVar, DoIt
MyVar = MsgBox ("Test", 65, "title")
DoIt = request("submit")

If DoIt = "Submit" Then
If Request.Form(TGsubject) = "" or Request.Form(Comment) = "" Then
MyVar()
End If
End If


I keep getting this error...

Permission denied: 'MsgBox'

Thanks,
Larry:thumbsup:

whammy
09-19-2002, 03:56 PM
Well, you are creating MyVar as a variable and then trying to call it like a subroutine. That's why it isn't working.

ldiuf
09-19-2002, 03:57 PM
how do I fix it?

:confused:

whammy
09-19-2002, 07:31 PM
I'm not sure what you're trying to do - unfortunately from the script you showed, it gives me no clue at all... ?!?

glenngv
09-20-2002, 02:17 AM
MsgBox is only used in client-side VBScript :D
You can't used it in server-side.
If you think about it, displaying an alert box is client-side in nature, which needs acknowledgment from the user. This oppose to the server-side nature which accepts http requests from the client then throws http response which is HTML


< INPUT TYPE="BUTTON" NAME="button_2" VALUE="Click Here!"> >

< SCRIPT LANGUAGE="VBScript" >
Sub button_2_onclick
MsgBox "Please Click!", VBRetryCanel, "MsgBox Demo"
End Sub
< /SCRIPT >

whammy
09-20-2002, 12:56 PM
Ahh I see... if you need an alert, you can use javascript (on the client side) in combination with server-side ASP/VBScript.

If you need more help with that let me know.

However, if you're going to validate stuff server-side, you should just show error text or something instead of using javascript. Take a look at the first Email form I made for dhtmlhelp - it has a decent example of how to validate a form server-side.