www.webdeveloper.com
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2011
    Location
    Haarlem
    Posts
    30

    stop page processing after an alert

    Hey guys, atm I´m really stump.

    Mine php skills is quite high but not mine Javascript.

    Anyway for start here is mine script.

    <head>

    <title>Registratie</title>
    <script type="text/javascript">
    function dbclick()
    {
    alert("test");
    }

    </script>
    </head>

    <body>
    Vul deze form in om je aan te melden voor de Kalender.

    <form action="regcheck.php" method="post">
    Gebruikers Naam<br>
    <input type="text" size="15" name="ruser" id="ruser" ><br>
    Persoonlijk Wachtwoord<br>
    <input type="text" size="15" id="rpassword" name="rpassword"><br>
    <input type="submit" ondblclick="dbclick()" id="submits" value="Aanmelden">
    </form>
    </body>

    I´m looking for a way once a user double click the submit button that an alert message will be popped up.
    Once the alert has been popped up, the page processing to regcheck.php must be stopped.

  2. #2
    Join Date
    Mar 2011
    Posts
    792
    Unless you have a special purpose in mind, 'ondblclick()' is probably not a good choice because users rarely double-click on a 'Submit' button since all that's needed is a single click. So use 'onclick' instead and have the function it calls return a true or false value: 'true' if the form should be submitted to the 'action', and 'false' if the user should be kept at the page where the form resides. As in:
    Code:
    <head>
    
    <title>Registratie</title>
    <script type="text/javascript">
    function myfunction()
    {
    alert("test");
    var value = true;
      if (something == bad) { value = false; }
     return value;
    }
    </script>
    </head>
    
    <body>
    Vul deze form in om je aan te melden voor de Kalender.
    <form action="regcheck.php" method="post">
    Gebruikers Naam<br>
    <input type="text" size="15" name="ruser" id="ruser" ><br>
    Persoonlijk Wachtwoord<br>
    <input type="text" size="15" id="rpassword" name="rpassword"><br>
    <input type="submit" onclick="return myfunction();" id="submits" value="Aanmelden">
    </form>
    </body>
    Rick Trethewey
    Rainbo Design

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

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



Recent Articles