SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist dhtmlhelp's Avatar
    Join Date
    May 2003
    Posts
    575
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Intergating various scripts in one function

    Hi,

    I am trying to integrate all the following scripts in one function but I am getting a conflict with the email verification and the check box check. Can someone take a look and suggest how I can integrate correctly the email verification function with the submitHandler function?

    DH

    Code:
    function checkEmail(myForm) {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.email.value)){
    return (true)
    }
    alert("\nYou have entered an Invalid Email Address, please verify")
    return (false)
    }
    
    function checkCheckBox(f){
    if (f.agree.checked == false )
    {
    alert('\nPlease confirm that you have read and agree to our Terms & Conditions');
    return false;
    }else
    return true;
    }
    
    function submitonce(theform){
    if (document.all||document.getElementById){
    for (i=0;i<theform.length;i++){
    var tempobj=theform.elements[i]
    if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
    tempobj.disabled=true
    }
    }
    }
    
    function submitForm(s)  {
    s.value = "  Processing ...  ";
    return true;
    }
    
    function submitHandler( f )
    {
    	if ( checkCheckBox( f ) )
    	{
    		checkEmail( f );
    		submitonce( f );
    		submitForm( f.submit );
    		return true;
    	}
    	return false;
    }

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi DH, sorry we missed the other thread.

    I'm not sure if I completely understand, but here's a shot at it...
    Code:
    function submitHandler( f )
    {
      if ( checkCheckBox( f ) && checkEmail( f ) )
      {
        submitonce( f );
        submitForm( f.submit );
        return true;
      }
      return false;
    }

  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
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right on, beetle


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
  •