SitePoint Sponsor

User Tag List

Page 2 of 5 FirstFirst 12345 LastLast
Results 26 to 50 of 125
  1. #26
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    k below is my link to the script......http://jsfiddle.net/ravi951/NfjwK/
    Thanks. You've messed up the validate function and the way it relates to the rest of the script.

    Go back to the script that you first began with. If you have any confusion about which script that is, it is the script that you posted in the original post of this thread.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  2. #27
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    k there is another successnew.html which i have not posted.
    i am looking at my script tell me what went wrong....

  3. #28
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    k there is another successnew.html which i have not posted.
    i am looking at my script tell me what went wrong....
    Which you have not posted?

    Let me know when you have decided to do so, and the link for the latest version.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #29
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no it is simple just displays success message below is the one.....
    i dont know where to paste there in jsfiddle......

    successnew.html
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Dynamic Inline Form Validation Demo</title>
    <link rel="stylesheet" type="text/css" href="messagesnew.css" />
    <script type="text/javascript" src="messagesnew.js"></script>
    </head>
    <body>
    <div id="wrapper">
      Successfully submitted!
    </div>
    </body>
    </html>

  5. #30
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    no it is simple just displays success message below is the one.....
    I am still seeing at the link you provided, what looks to still be the broken code you're having troubles with. It is not the script that you first began with.

    Have you replaced the script with the original script that you first began with? If so, and if that's what you're still having trouble with, a link to that version would be appreciated.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #31
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are u unable to see my fiddle below is the one

    http://jsfiddle.net/ravi951/Rp29D/1/

    is there any thing extra to select in jsfiddle like framework or any other things.......

    i have copied each script in to its own block and clicked the save button...
    and the link is given to u.....

    this is the original script i am working before

  7. #32
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    are u unable to see my fiddle below is the one

    http://jsfiddle.net/ravi951/Rp29D/1/
    Yes, I can see that there. The script in that page starts with:

    Code:
    // form validation function //
    
    function validate() 
    {
       function checkName(form)
    That is the non-functioning script.

    The script that I expect to see is that which you used on your first post to this thread.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  8. #33
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do u mean this one......

    Code:
    // form validation function //
    
    function validate() 
    {
        var form = document.forms['form'];
        var ary = [checkName,checkEmail,validatePwd,validPhone];
        var rtn = true;
        var z0 = 0;
        for (var z0 = 0; z0 < ary.length; z0++) 
        {
            if (!ary[z0](form)) 
            {
                rtn = false;
            }
        }
        return rtn;
    }
     
    function checkName(form) 
    {
        var eobj = document.getElementById('realnameerror');
        var sRealName = form.realname.value;
        var oRE = /^[a-z0-9]+[_.-]?[a-z0-9]+$/i;
        var error = false;
        eobj.innerHTML = '';
        if (sRealName == '') 
         {
            error = 'Error: Username cannot be blank!';
         }
        else if (sRealName.length < 4) 
        {
            error = "UserName should be atleast 4 characters long";
        }
        else if (!oRE.test(sRealName)) 
        {
            error = "Incorrect format.";
        }
        if (error) 
        {
            if (hasFocus == false) 
             {
                form.realname.focus();
                hasFocus = true;
             }
            eobj.innerHTML = error;
            return false;
        }
        return true;
    }
     
    function checkEmail(form)          /* for email validation */ 
    {
        var eobj = document.getElementById('emailerror');
        eobj.innerHTML = '';
        var error = false;
        if(form.email.value.length == 0) 
        {
            error = 'Please enter email.';
        } else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.email.value)) 
           {
            return true;
           } else 
              {
            error = 'Invalid E-mail Address! Please re-enter.';
              }
        if (error) 
         {
            eobj.innerHTML = error;
            if (!hasFocus) 
              {
                form.email.focus();
                hasFocus = true;
              }
            return false;
         }
         return true;
    }
    
    function validatePwd(form)          /* password & retype-password verification */ 
    {
        var eobj1 = document.getElementById('passworderror');
        var eobj2 = document.getElementById('password2error');
        var minLength = 6;
        var invalid = ' ';
        var pw1 = form.password.value;
        var pw2 = form.password2.value;
        var error = false;
        eobj1.innerHTML = '';
        eobj2.innerHTML = '';
        if (pw1.length < 1) 
    	{
            error = 'Please enter your password.';
        }
    
        else if (pw1.length < minLength) 
    	{
            error = 'Your password must be at least ' + minLength + ' characters long. Try again.';
        }
    
        else if (pw1.indexOf(invalid) > -1) 
    	{
            error = 'Sorry, spaces are not allowed.';
        }
    
        else if (pw2.length == 0) 
    	{
            error = 'Please retype password.';
            if (!hasFocus)
    		{
                form.password2.focus();
                hasFocus = true;
            }
            eobj2.innerHTML = error;
            return false;
        }
        if (error) 
    	{
            if (!hasFocus) 
    		{
                form.password.focus();
                hasFocus = true;
            }
            eobj1.innerHTML = error;
            return false;
        }
    
        if (pw1 != pw2) 
    	{
            eobj2.innerHTML = ' passwords not matching.Please re-enter your password.';
            if (!hasFocus) 
    		{
                form.password2.focus();
                hasFocus = true;
            }
            return false;
        }
        return true;
    }
    
    function validPhone(form)              /* phone no validation */ 
    {
        var eobj = document.getElementById('phonenoerror');
        var valid = '0123456789';
        var phone = form.phoneno.value;
        var error = false;
        var i = 0;
        var temp;
        eobj.innerHTML = '';
        if (phone == '') 
    	{
            error = 'This field is required. Please enter phone number';
        }
        else if (!phone.length > 1 || phone.length < 10) 
    	{
            error = 'Invalid phone number length! Please try again.';
        }
        else 
    	{
            for (i = 0; i < phone.length; i++) 
    		{
                temp = '' + phone.substring(i, i + 1);
                if (valid.indexOf(temp) == -1) 
    			{
                    error = 'Invalid characters in your phone. Please try again.';
                }
            }
        }
        if (error) 
    	{
            if (!hasFocus) 
    		{
                form.phoneno.focus();
                hasFocus = true;
            }
            eobj.innerHTML = error;
            return false;
        }
        return true;
    }
    // START OF MESSAGE SCRIPT //
    
    var MSGTIMER = 20;
    var MSGSPEED = 5;
    var MSGOFFSET = 3;
    var MSGHIDE = 3;
    
    // build out the divs, set attributes and call the fade function //
    function inlineMsg(target,string,autohide) {
      var msg;
      var msgcontent;
      if(!document.getElementById('msg')) {
        msg = document.createElement('div');
        msg.id = 'msg';
        msgcontent = document.createElement('div');
        msgcontent.id = 'msgcontent';
        document.body.appendChild(msg);
        msg.appendChild(msgcontent);
        msg.style.filter = 'alpha(opacity=0)';
        msg.style.opacity = 0;
        msg.alpha = 0;
      } else {
        msg = document.getElementById('msg');
        msgcontent = document.getElementById('msgcontent');
      }
      msgcontent.innerHTML = string;
      msg.style.display = 'block';
      var msgheight = msg.offsetHeight;
      var targetdiv = document.getElementById(target);
      targetdiv.focus();
      var targetheight = targetdiv.offsetHeight;
      var targetwidth = targetdiv.offsetWidth;
      var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2);
      var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET;
      msg.style.top = topposition + 'px';
      msg.style.left = leftposition + 'px';
      clearInterval(msg.timer);
      msg.timer = setInterval("fadeMsg(1)", MSGTIMER);
      if(!autohide) {
        autohide = MSGHIDE;  
      }
      window.setTimeout("hideMsg()", (autohide * 1000));
    }
    
    // hide the form alert //
    function hideMsg(msg) {
      var msg = document.getElementById('msg');
      if(!msg.timer) {
        msg.timer = setInterval("fadeMsg(0)", MSGTIMER);
      }
    }
    
    // face the message box //
    function fadeMsg(flag) {
      if(flag == null) {
        flag = 1;
      }
      var msg = document.getElementById('msg');
      var value;
      if(flag == 1) {
        value = msg.alpha + MSGSPEED;
      } else {
        value = msg.alpha - MSGSPEED;
      }
      msg.alpha = value;
      msg.style.opacity = (value / 100);
      msg.style.filter = 'alpha(opacity=' + value + ')';
      if(value >= 99) {
        clearInterval(msg.timer);
        msg.timer = null;
      } else if(value <= 1) {
        msg.style.display = "none";
        clearInterval(msg.timer);
      }
    }
    
    // calculate the position of the element in relation to the left of the browser //
    function leftPosition(target) {
      var left = 0;
      if(target.offsetParent) {
        while(1) {
          left += target.offsetLeft;
          if(!target.offsetParent) {
            break;
          }
          target = target.offsetParent;
        }
      } else if(target.x) {
        left += target.x;
      }
      return left;
    }
    
    // calculate the position of the element in relation to the top of the browser window //
    function topPosition(target) {
      var top = 0;
      if(target.offsetParent) {
        while(1) {
          top += target.offsetTop;
          if(!target.offsetParent) {
            break;
          }
          target = target.offsetParent;
        }
      } else if(target.y) {
        top += target.y;
      }
      return top;
    }
    // preload the arrow //
    if(document.images) {
      arrow = new Image(7,80); 
      arrow.src = "images/msg_arrow.gif"; 
    }

  9. #34
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    do u mean this one......
    No, I mean the one from your first post to this thread.

    Do you know how to find the first post?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  10. #35
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is the first script i have posted i have taken it from where i posted.....

    Code:
    // form validation function //
     function checkName(form)
    {
      var eobj=document.getElementById('realnameerror');
      var sRealName = form.realname.value;
      var oRE = /^[a-z0-9]+[_.-]?[a-z0-9]+$/i;
      var error=false;
      eobj.innerHTML='';
      if (sRealName == '') 
      {
       error='Error: Username cannot be blank!';
      }
      else if (sRealName.length < 4) 
      {
        error="UserName should be atleast 4 characters long";
      }
      else if (!oRE.test(sRealName))
      {
       error="Incorrect format.";
      }
      if (error)
    {
       if (hasFocus == false) 
       {
         form.realname.focus();
         hasFocus = true;
       } 
       eobj.innerHTML=error;
       return false;
      }
      return true;
     }
    
    function checkEmail(form)          /* for email validation */
    {
     var eobj=document.getElementById('emailerror');
     eobj.innerHTML='';
     var error = false;
      if (form.email.value.length == 0) 
      {
        error = 'Please enter email.';
      } else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.email.value))
     {
      return true;
     } else 
     {
       error = 'Invalid E-mail Address! Please re-enter.';
     }
     if (error) 
    {
       eobj.innerHTML=error;
       if (!hasFocus) 
       {
         form.email.focus();
         hasFocus = true;
       } 
       return false;
     }
    
     return true;
    }
    
    function validatePwd(form)          /* password & retype-password verification */
    {       
     var eobj1=document.getElementById('passworderror');
     var eobj2=document.getElementById('password2error');
     var minLength=6;
     var invalid=' ';
     var pw1=form.password.value;
     var pw2=form.password2.value;
     var error=false;
     eobj1.innerHTML='';
     eobj2.innerHTML='';
     if (pw1.length<1)
     {
      error='Please enter your password.';
     }
     else if (pw1.length < minLength)
     {
      error='Your password must be at least ' + minLength + ' characters long. Try again.';
     }
     else if (pw1.indexOf(invalid) > -1)
     {
      error='Sorry, spaces are not allowed.';
     } 
    else if (pw2.length == 0) 
    {
      error='Please retype password.';
       if (!hasFocus) 
       {
         form.password2.focus();
         hasFocus = true;
       } 
      eobj2.innerHTML=error;
      return false;
     }
     if (error)
     {
       if (!hasFocus) 
       {
         form.password.focus();
         hasFocus = true;
       } 
        eobj1.innerHTML=error;
      return false;
     }
     if (pw1 != pw2)
     {
      eobj2.innerHTML=' passwords not matching.Please re-enter your password.';
       if (!hasFocus) 
       {
         form.password2.focus();
         hasFocus = true;
       } 
      return false;
     }
     return true;
    }
    
    function validPhone(form)              /* phone no validation */
    {          
     var eobj=document.getElementById('phonenoerror');
     var valid = '0123456789';
     var phone = form.phoneno.value;
     var error=false;
     var i=0;
     var temp;
     eobj.innerHTML='';
     if (phone == '')
     {
      error='This field is required. Please enter phone number';
     }
     else if (!phone.length > 1 || phone.length < 10)
     {
      error='Invalid phone number length! Please try again.';
     }
     else 
     {
      for (i=0; i < phone.length; i++)
     {
       temp = '' + phone.substring(i, i + 1);
       if (valid.indexOf(temp) == -1)
        {
        error='Invalid characters in your phone. Please try again.';
        }
      }
     }
     if (error)
     {
       if (!hasFocus) 
       {
         form.phoneno.focus();
         hasFocus = true;
       } 
      eobj.innerHTML=error;
      return false;
     }
     return true;
    }
    
    function validate() 
     {
      hasFocus = false;
     var form = document.forms['form'];
     var ary=[checkName,checkEmail,validatePwd,validPhone];
     var rtn=true;
     var z0=0;
     for (var z0=0;z0<ary.length;z0++)
    {
      if (!ary[z0](form))
      {
        rtn=false;
      }
     }
     return rtn;
    }
    
    // START OF MESSAGE SCRIPT //
    
    var MSGTIMER = 20;
    var MSGSPEED = 5;
    var MSGOFFSET = 3;
    var MSGHIDE = 3;
    
    // build out the divs, set attributes and call the fade function //
    function inlineMsg(target,string,autohide) {
      var msg;
      var msgcontent;
      if(!document.getElementById('msg')) {
        msg = document.createElement('div');
        msg.id = 'msg';
        msgcontent = document.createElement('div');
        msgcontent.id = 'msgcontent';
        document.body.appendChild(msg);
        msg.appendChild(msgcontent);
        msg.style.filter = 'alpha(opacity=0)';
        msg.style.opacity = 0;
        msg.alpha = 0;
      } else {
        msg = document.getElementById('msg');
        msgcontent = document.getElementById('msgcontent');
      }
      msgcontent.innerHTML = string;
      msg.style.display = 'block';
      var msgheight = msg.offsetHeight;
      var targetdiv = document.getElementById(target);
      targetdiv.focus();
      var targetheight = targetdiv.offsetHeight;
      var targetwidth = targetdiv.offsetWidth;
      var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2);
      var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET;
      msg.style.top = topposition + 'px';
      msg.style.left = leftposition + 'px';
      clearInterval(msg.timer);
      msg.timer = setInterval("fadeMsg(1)", MSGTIMER);
      if(!autohide) {
        autohide = MSGHIDE;  
      }
      window.setTimeout("hideMsg()", (autohide * 1000));
    }
    
    // hide the form alert //
    function hideMsg(msg) {
      var msg = document.getElementById('msg');
      if(!msg.timer) {
        msg.timer = setInterval("fadeMsg(0)", MSGTIMER);
      }
    }
    
    // face the message box //
    function fadeMsg(flag) {
      if(flag == null) {
        flag = 1;
      }
      var msg = document.getElementById('msg');
      var value;
      if(flag == 1) {
        value = msg.alpha + MSGSPEED;
      } else {
        value = msg.alpha - MSGSPEED;
      }
      msg.alpha = value;
      msg.style.opacity = (value / 100);
      msg.style.filter = 'alpha(opacity=' + value + ')';
      if(value >= 99) {
        clearInterval(msg.timer);
        msg.timer = null;
      } else if(value <= 1) {
        msg.style.display = "none";
        clearInterval(msg.timer);
      }
    }
    
    // calculate the position of the element in relation to the left of the browser //
    function leftPosition(target) {
      var left = 0;
      if(target.offsetParent) {
        while(1) {
          left += target.offsetLeft;
          if(!target.offsetParent) {
            break;
          }
          target = target.offsetParent;
        }
      } else if(target.x) {
        left += target.x;
      }
      return left;
    }
    
    // calculate the position of the element in relation to the top of the browser window //
    function topPosition(target) {
      var top = 0;
      if(target.offsetParent) {
        while(1) {
          top += target.offsetTop;
          if(!target.offsetParent) {
            break;
          }
          target = target.offsetParent;
        }
      } else if(target.y) {
        top += target.y;
      }
      return top;
    }
    // preload the arrow //
    if(document.images) {
      arrow = new Image(7,80); 
      arrow.src = "images/msg_arrow.gif"; 
    }

  11. #36
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    this is the first script i have posted i have taken it from where i posted.....
    Yes, that is the one that I mean.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  12. #37
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in login.html i have the below form

    <form name="form" id="form" class="form" action="successnew.html" onsubmit="return validate(this)" method="post">

    means on submitting the validate() button i want javascript function to execute
    which is i just now given to you..

    with out clicking how can we check the validate() for all the functions like
    username,email id...etc...

  13. #38
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    with out clicking how can we check the validate() for all the functions like
    username,email id...etc...
    What do you mean by "without clicking"? By blinking our eyes rapidly instead? Or by using mind power in some way?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  14. #39
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when we click on the "submit" button only it will check the validate() function
    right...
    now i need to seperately work for validate() function.....
    what i did is in validate() function i am checking each function individually which is username() function,emailid() function,password() function and so on .....
    is that the wrong method what i am doing.....

  15. #40
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    when we click on the "submit" button only it will check the validate() function
    right...
    Not just only that. The validate function checks the username, email, password, and phone.

    You don't need to edit the script at all in any way.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  16. #41
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    then how to assign validate() function to the javascript which i have created in my HTML code....

    then is there any other way to do like that means with out assigning validate() function to javscript..

  17. #42
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    then how to assign validate() function to the javascript which i have created in my HTML code....
    That is already done in the onsubmit event.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  18. #43
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    then what does the validate() function contains actually....

  19. #44
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    then what does the validate() function contains actually....
    Here is the contents of that function, which is pretty much copy/pasted from your recently posted listing:

    Code javascript:
    function validate() {
      hasFocus = false;
      var form = document.forms['form'];
      var ary=[checkName,checkEmail,validatePwd,validPhone];
      var rtn=true;
      var z0=0;
      for (var z0=0;z0<ary.length;z0++) {
        if (!ary[z0](form)) {
          rtn=false;
        }
      }
      return rtn;
    }
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  20. #45
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    then i need to save it as messagesnew.js right

  21. #46
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    then i need to save it as messagesnew.js right
    The entire script from your first post, right.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  22. #47
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    first post i have saved as messagesnew.js means which contain all the functions
    now where to paste
    the below code
    Code:
    function validate() {
      hasFocus = false;
      var form = document.forms['form'];
      var ary=[checkName,checkEmail,validatePwd,validPhone];
      var rtn=true;
      var z0=0;
      for (var z0=0;z0<ary.length;z0++) {
        if (!ary[z0](form)) {
          rtn=false;
        }
      }
      return rtn;
    }

  23. #48
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ravi951 View Post
    first post i have saved as messagesnew.js means which contain all the functions
    now where to paste
    the below code
    Don't. It's already there.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  24. #49
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    then why my script is not executing...
    whats the problem...what will be my total script..

  25. #50
    SitePoint Addict
    Join Date
    Jul 2011
    Location
    Hyderabad,India.
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    then the script i sent u before was as same as the script you told ...
    that too not executing....
    what i need to change then..........


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
  •