Results 1 to 6 of 6

Thread: method=post action=script.asp

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    48

    Question

    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

  2. #2
    Guest
    I am not too sure but you could use

    window.close()

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    48

    Unhappy Nope

    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??

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    48

    Talking Never mind

    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!

  5. #5
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Or:

    Code:
    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.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  6. #6
    Addicted Member
    Join Date
    Jun 2000
    Location
    Pittsburgh, PA
    Posts
    149
    What you need to do is place an onsubmit in your form tag with return javascript.

    Code:
    <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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width