SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast BigKingy's Avatar
    Join Date
    Jun 2004
    Location
    London
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking Form validation, then a popup. How?...

    Im after a javascript validation script that will trigger a popup ONLY if the form data validates fine. If it doesnt validate correctly, then it wont display the popup.

    Can anyone point me in the right direction of a script that does this, or recommend a validation script that could be customised to do this?

    Your opinions and recommendations would be most appriciated.

    Cheers.

    P.S. The user shall be expecting the popup, im not bombarding them with a nuisance popup!

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <form onsubmit="return validateForm(this);" ... etc
    
    
    function validateForm(oForm)
    {
        /* Whatever validation you wanna do */
        if(oForm.whatEverField.value.length > 0)
        {
            window.open("", "", "");
            return true;
        }
        else
        {
            return false;
        }
    }

  3. #3
    SitePoint Enthusiast BigKingy's Avatar
    Join Date
    Jun 2004
    Location
    London
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Pepejeria: That worked great thanks!

    But what about if I want to validate more than 1 field? Thanks for your help.

  4. #4
    SitePoint Enthusiast BigKingy's Avatar
    Join Date
    Jun 2004
    Location
    London
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK I have figured it out, thanks.


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
  •