PDA

Click to See Complete Forum and Search --> : method=post action=script.asp


msuryadarma
Oct 3rd, 2000, 12:12 PM
Hi, I have <method=post action=script.asp> in my form html page. But I have a problem.

Here is part of the code:

Sub cmdGo_OnClick
If (Len(Document.frmOpening.txtGuestNum.Value) = 0) Then
MsgBox "Please enter at least 1 guest."
Exit Sub
End Sub

Now, the problem is, I want the html page to STOP if the user didn't input any guests. How do I do it? This setting doesn't make the thing stop, it displays the MsgBox, then goes to the script.asp.

Please help me make it stop. Thanks. I'm a newbie.

Martin

Oct 3rd, 2000, 12:17 PM
I am not too sure but you could use

window.close()

msuryadarma
Oct 3rd, 2000, 03:07 PM
No, that's not what I want.

window.close() will close the window.

What I want is after the msgbox appears, the user can enter the right value into the box, then proceed. But I don't want to proceed when it's not the right value.

Anyone??

msuryadarma
Oct 3rd, 2000, 03:11 PM
Never mind, I got it. I just had to set the command type to be button instead of submit. then I put submit as one of the condition results. Thanks!

monte96
Oct 3rd, 2000, 04:01 PM
Or:


Function frmOpening_onsubmit()
If (Len(Document.frmOpening.txtGuestNum.Value) = 0) Then
window.alert "Please enter at least 1 guest."
'This will prevent the form from submitting
frmOpening_onsubmit=False
End If
End Function


with the button remaining a submit button.

jdavison
Oct 3rd, 2000, 04:10 PM
What you need to do is place an onsubmit in your form tag with return javascript.



<FORM method=post action=asppage.asp onsubmit="return (javascript function)">

-rest of form-
</FORM>


have the javascript function return a false(i think, I always mix up which does which) and it will stop the submission.