jQuery Live Form Validation Version 1.1

Home / Javascript
24September

jQuery Live Form Validation Version 1.1

About the Author

Comments

    GeekTantra - October 5, 2009

    Hi, may I know how to validate confirm password field? I need to validate that the confirm password field should be the same as input in the password field.
    Thanks

    Reply
      GeekTantra - October 5, 2009

      Hi azril,

      Thanks for your comment. I have added a password and confirm password field example to the advanced demo of jQuery Live Form Validation ( http://www.geektantra.com/projects/jquery-form-validate/advanced_demo/ ). Just check its source to have a better understanding. Its actually very simple. In the expression for the confirm password validation just put an if statement to check if it matches the password.

      GeekTantra

      Reply
    GeekTantra - October 22, 2009

    mm... attractive ))

    Reply
    GeekTantra - December 2, 2009

    Hey how to do validation for url please its urgent

    Reply
    GeekTantra - January 21, 2010

    Is it possible to do custom validation, something like; if text field is empty and drop down not selected then display message?

    Reply
    GeekTantra - September 29, 2010

    Can't get isValidDate to work for months 08 and 09.

    Reply
      GeekTantra - October 12, 2010

      I double checked it with 8-31-2010 and 9-30-2010 it is working fine. Please check your implementation.

      Reply
    GeekTantra - October 11, 2010

    I can't get checkbox validation to work.
    I always get "not checked" error message no matter if checked or not.

    Is there a solution. I double checked, and it seems to me that everything conforms to your example.

    Reply
      GeekTantra - October 12, 2010

      Hi Nikola

      Can you show me the script your are working on?

      I guess it might be a minor config issue.

      Regards,
      GeekTantra

      Reply
        GeekTantra - August 21, 2011

        I was looking everyehwre and this popped up like nothing!

        Reply
        GeekTantra - August 26, 2011
    GeekTantra - October 14, 2010

    I declare that I have read and I agree with the Terms & Conditions

    and I've put your default script from demo changed to find #tcaccept in my header

    jQuery("#tcaccept").validate({
    expression: "if (isChecked(SelfID)) return true; else return false;",
    message: "Please check this to agree to Terms & Conditions."
    });

    I always get the error message. No matter if it's checked or not

    Reply
      GeekTantra - October 14, 2010

      ok. just lost my html code above. sorry.
      I have just a straight input type=checkbox name=tcaccept id=tcaccept value=on
      I removed quotes and other special chars

      Thanks in advance
      Nikola

      Reply
        GeekTantra - October 17, 2010

        Hi Nikola,

        If you observe the advanced demo carefully. The validation example for checkboxes given there is for a set of checkboxes out enclosed in the id="ValidCheckbox". You have two options to implement your case, either use it with the enclosing id or write the following expression:
        jQuery(“#tcaccept”).validate({
        expression: “if (jQuery('#tcaccept').is(':checked')) return true; else return false;”,
        message: “Please check this to agree to Terms & Conditions.”
        });

        I guess the above solution will fit your needs perfectly.

        Regards,
        GeekTantra

        Reply
    GeekTantra - November 16, 2010

    hi, very nice solution on the radiobuttons. I have a problem. I make several forms on a page via mysql. They are in a hidden div. When clicked on a link one of them wil show. In every form are radiobuttons with different id's. How can I pass those id's to the script so I have to use only one script for all the forms.

    Reply
    GeekTantra - November 25, 2010

    excellent tutorial

    Reply
    GeekTantra - March 25, 2011

    The reg expression for validating no spaces is not working: /^[\S]*$/

    Reply
    GeekTantra - November 14, 2011

    Excellent script, but I was having some strange behaviour when combining this with jQuery UI's Datepicker option.

    The problem was that if a validation error had been triggered and you then proceeded to set a date the error message was not cleared unless you again clicked in and out of the field (or just ignored the error and carried on, but this is not helpful to the end user!). To overcome this I added 'change' to the bind parameters in jquery.validate.js line 46.

    Before: jQuery(this).bind('focus keypress', function(){
    After: jQuery(this).bind('focus keypress change', function(){

    I have not tested all of the features of the validate script to see if this causes any problems elsewhere but thought I would post in case it helps anyone else as it solves the problem for me.

    GeekTantra, hope you don't mind my tinkering with your code.

    Reply
    GeekTantra - June 11, 2012

    Is there any solution to expand validation form by place the code that adding two random numbers

    Reply
      GeekTantra - June 28, 2012

      please :)

      Reply
    GeekTantra - July 18, 2012

    var a = Math.ceil(Math.random() * 10);
    var b = Math.ceil(Math.random() * 10);
    var c = a + b
    function Draw()
    {
    document.write( a + " + " + b +" ");
    document.write("");
    }
    .
    .
    .
    jQuery("#adding").validate({
    expression: "var d = document.getElementById('adding').value; if (d == c) return true; else return false;",
    message: "Enter valid number..."
    });

    .
    .
    .
    in html enter these DrawBotBoot()

    Reply
    GeekTantra - August 22, 2012

    Its good but i found one issue with live validation of check-box and radio on Google Chrome.
    its only working on submit button click but as live validation of checkbox and radio its not working. with other browsers its working as expected.
    Any solution ?

    Reply
    GeekTantra - November 23, 2012

    how to show error message below the input fields, please tell me urgent .
    thankyou

    Reply
      GeekTantra - January 4, 2013

      In jquery.validate.css need to make little change like

      span.ValidationErrors {
      display: table-row-group;
      font-size: 12px;
      font-weight: 700;
      color: #D00 !important;
      padding-left: 10px;
      font-style: normal;
      text-shadow: 0 1px 0 #fff
      }

      U see in display attribute i change value, after that u get achive ur result.

      Reply
    GeekTantra - January 4, 2013

    Hi, really its good for me, but I need little much ur help.

    I want to make hide means remove all validation on click of clear button or reset button.

    How's it possible?

    Reply
    GeekTantra - May 1, 2013

    function hasUpperCase(password) {
    return /[A-Z]/.test(password);
    }
    function hasLowerCase(password) {
    return /[a-z]/.test(password);
    }
    function hasNumbers(password) {
    return /\d/.test(password);
    }
    function hasNonalphas(password) {
    return /\W/.test(password);
    }
    $(document).ready(function(){
    $("#user_password").validate({
    expression: "if (VAL && VAL.length > 8 && hasUpperCase(VAL) && hasLowerCase(VAL) && hasNumbers(VAL) && hasNonalphas(VAL)) return true; else return false;",
    message: "You must enter a valid password to continue."
    });
    $("#user_confirm_password").validate({
    expression: "if ((VAL == $('#user_password').val()) && VAL) return true; else return false;",
    message: "Your passwords must match!"
    });
    });

    Reply
      GeekTantra - May 1, 2013

      Woops. This was password validation. Please validate serverside as well... this is just for pretty-ness for your users.

      Reply
    GeekTantra - July 10, 2013

    i have used the validation many times. Got a new prob, for example in an input for name i have default value "Type a name or reference", thus i dont have error msg as the input is considered as filled. Is there any parameter just not to validate the default value you put in the HTML of the input?

    Thanks in advance for any help. :)

    Reply
    GeekTantra - September 7, 2013

    hi,

    how can i show message with dynamic value? i tried to pass variable to the message , but it just use the value i first set, not updated

    Reply
    GeekTantra - July 1, 2014

    Hi,

    Thanks for the plugin it is working very well.

    I want to keep my submit button disabled until all required fields are validated.

    Is there some check I can do to ensure all required fields have been filled correctly before enabling the submit button?

    /Paul.

    Reply

Leave a Comment

Notify me of followup comments via e-mail

Get Adobe Flash player