SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Form validation

  1. #1
    SitePoint Member
    Join Date
    Nov 2003
    Location
    Barcelona
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Form validation

    I have a form with several fields and I need to validate it before going to next page. How can I linked the functions so that when the user click the link below all the functions start runing?

    I read something about '<script src="Whatever.js">' but I do not know how it runs.

    Thanks,
    Cesar

  2. #2
    SitePoint Enthusiast ArgentinaCoders's Avatar
    Join Date
    Nov 2003
    Location
    Argentina
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is some like this..

    PHP Code:
    <script>
    function 
    validator(){
        if (!
    document.form1.some_name.value){
            
    alert("The some_name information is required");
            return 
    false;
        }
    }
    </script>


    <form name="form1" action="some_page" onsubmit="return validator();"
    <input type="text" name="some_name">
    </form> 

  3. #3
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  4. #4
    SitePoint Member
    Join Date
    Nov 2003
    Location
    Barcelona
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, thank you


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
  •