Git Product home page Git Product logo

jquery-validation's Introduction

jQuery Validation Plugin - Form validation made easy

release Build Status devDependency Status jsDelivr Hits

The jQuery Validation Plugin provides drop-in validation for your existing forms, while making all kinds of customizations to fit your application really easy.

Getting Started

Downloading the prebuilt files

Prebuilt files can be downloaded from https://jqueryvalidation.org/

Downloading the latest changes

The unreleased development files can be obtained by:

  1. Downloading or Forking this repository
  2. Setup the build
  3. Run grunt to create the built files in the "dist" directory

Including it on your page

Include jQuery and the plugin on a page. Then select a form to validate and call the validate method.

<form>
	<input required>
</form>
<script src="jquery.js"></script>
<script src="jquery.validate.js"></script>
<script>
    $("form").validate();
</script>

Alternatively include jQuery and the plugin via requirejs in your module.

define(["jquery", "jquery.validate"], function( $ ) {
	$("form").validate();
});

For more information on how to setup a rules and customizations, check the documentation.

Reporting issues and contributing code

See the Contributing Guidelines for details.

IMPORTANT NOTE ABOUT EMAIL VALIDATION. As of version 1.12.0 this plugin is using the same regular expression that the HTML5 specification suggests for browsers to use. We will follow their lead and use the same check. If you think the specification is wrong, please report the issue to them. If you have different requirements, consider using a custom method. In case you need to adjust the built-in validation regular expression patterns, please follow the documentation.

IMPORTANT NOTE ABOUT REQUIRED METHOD. As of version 1.14.0 this plugin stops trimming white spaces from the value of the attached element. If you want to achieve the same result, you can use the normalizer that can be used to transform the value of an element before validation. This feature was available since v1.15.0. In other words, you can do something like this:

$("#myForm").validate({
	rules: {
		username: {
			required: true,
			// Using the normalizer to trim the value of the element
			// before validating it.
			//
			// The value of `this` inside the `normalizer` is the corresponding
			// DOMElement. In this example, `this` references the `username` element.
			normalizer: function(value) {
				return $.trim(value);
			}
		}
	}
});

Accessibility

For an invalid field, the default output for the jQuery Validation Plugin is an error message in a <label> element. This results in two <label> elements pointing to a single input field using the for attribute. While this is valid HTML, it has inconsistent support across screen readers.

For greater screen reader support in your form's validation, use the errorElement parameter in the validate() method. This option outputs the error in an element of your choice and automatically adds ARIA attributes to the HTML that help with screen reader support.

aria-describedby is added to the input field and it is programmatically tied to the error element chosen in the errorElement parameter.

$("#myform").validate({
  errorElement: "span"
});
<label for="name">Name</label>
<input id="name" aria-describedby="unique-id-here">
<span class="error" id="unique-id-here">This field is required</span>

Learn more about errorElement

License

Copyright © Jörn Zaefferer
Licensed under the MIT license.

jquery-validation's People

Contributors

arkni avatar bidord avatar bytestream avatar christopherbauer avatar cope avatar dbrattli avatar digitalica avatar dorner avatar endelwar avatar ericdunsworth avatar g1smd avatar jamierytlewski avatar jaubourg avatar jcspader avatar johnnyreilly avatar juanmcuello avatar jzaefferer avatar maks3w avatar mlynch avatar nschonni avatar paladox avatar patheard avatar robjohnston avatar rskm1 avatar skotniczny avatar staabm avatar steelywing avatar synchro avatar thomasgohard avatar vanillajonathan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jquery-validation's Issues

Feature: Watermark built in

I've had some trouble working with Form Watermarks and this validation method. It would be very cool if watermarks were built in. A Watermark just being a default value. Example - . A watermark would make the input show Enter your name until they click on the option. It would be cool if the form validation would handle the removing of the default text for me :), and put the default text back when complete.

validator object in .data() is missing errors

  1. Open up example.html
  2. Click a field in the form and press enter. You should see 3 errors.
  3. Open up firebug or developer console and enter $("form").data('validator').errorList

I only see a single error object in errorList, but there ought to be three error objects.

Edit: I've been doing a little debugging and I think I've found the issue.

  • .element() is called once after form submission
  • .element() calls .prepareElement() which calls .reset() which empties out errorList.
    (If you console log errorList at the beginning of .element(), it shows all the errors. After the call to .prepareElement(), errorList is empty)
  • .element() only .check()'s a single element, and therefore only does enough to populate errorList with a single error.

HTML5 novalidate

Under HTML5, the validation plugin fails on input type="email" (in Chrome at least). The browser functionality overrides the plugin.

This can be overcome by adding novalidate to the

tag, ala:

See: http://diveintohtml5.org/forms.html#validation

Perhaps this could be something that the plugin automatically adds?

IE8 reports error with validate 1.8

IE8 reports an error every time query.validate-1.8.js is called. The error says this:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; InfoPath.1; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Timestamp: Wed, 30 Mar 2011 22:41:43 UTC

Message: Object doesn't support this property or method
Line: 303
Char: 5
Code: 0
URI: http://listserv-d.web.abbott.com/auth/ahd3/js/jquery.validate-1.8.js

toEqual method

I am using multiple creation forms for example: login, registration, remember. And in the page password field has the next name: 'user[password]' with id 'user_password'. May be replace toEqual method implementation of $(field) to finding the field for comparation in the scope of the fields in param form. for example: $(target).children().find(field) ... But add param to toEqual field for making as scope. toEqual: {id:'field', scope:true} or toEqual: {name:'user[field]', scope:true}. What do you think about it?

submitHandler callback does not replace native form submit

The submitHandler option of validate() does not work as documented on http://docs.jquery.com/Plugins/Validation/validate
According to the documentation, the callback "Replaces the default submit.". According to what we see, using a submitHandler adds a submit handler and inhibits the native form submit.

We hit this problem when adding a submit handler on a form. Even when the handler would return false, the form would be submitted. I found the cause was someone adding the validate plugin and a submitHandler on certain forms. Instead of stopping at the return false, submission continued running the submitHandler, which caused form submission because the submitHandler calls the default native form submit.

Disabling jQuery validate worked around, but we didn't find any better workaround.

add method removeClassRules

I need this because Drupal adds 'number' to certain fields

removeClassRules: function(className) {
this.classRuleSettings[className] = null;
},

Huge need for a bridge between jquery.global and jquery.validate

Hello,

My team is developing an e-commerce framework in ASP.Net MVC. Recently we upgraded it to MVC 3, and I have spent a large part of the day testing the new jquery.validate/unobtrusive javascript goodness.

All in all, it went pretty smooth, but our framework is intended to be multi-language oriented (or at least french oriented), and the need for a localization library came quickly. Previously we were using the Ajax.GlobalizationScript and the MicrosoftAjaxMvcValidation libraries, which were a little bit limited, but worked well.

I was excited by the possibility to use jquery.validate and all its neat features, but... it's proving very difficult to use it on an international website. Of course I expected jquery.global to come to the rescue, but it's not very easy. For example : validation of comma separated decimal numbers (which are default in french). A lot of forums like StackOverflow are giving this little trick :

jQuery.validator.methods.number = function (value, element) {
    return !isNaN(jQuery.global.parseFloat(value));
}

It works quite well, but actually you need to do that kind of "bridging" with all methods that parse possible decimal numbers (like range validation).

I'm seeing there is a jquery.validate 2.0 in the tubes, and I don't know what will come with it, but it would be great to be able to link it to a couple of localization parsing methods like the ones jquery.global is exposing.

In the meantime, keep up the good work!

Add hook for removing errors on resetForm()

Since there is a hook for success and error, there should also be one for reset which would be called on all invalid fields, when resetForm is invoked. success usually just removes error hints, so we could fallback to success, if reset is not provided.

I'm happy to submit a patch, if you agree in adding the feature.

Bug in Chrome, Safari validate date.

Failing for a valid date in Chrome/Safari, but passing in Firefox, IE etc.
Chrome/Safari seems to ignore the current locale when it creates the date object, so a valid date in UK dd/mm/yy format – 28/11/2010 – fails as Chrome seems to interpret it in US mm/dd/yy format.

reusing native rules

Hi there,

Is there a way to reuse native rules when defining your own custom validation methods? I'd like to define a rule "string_of_emails" and reuse the native email method but can't seem to make things click.

Thanks,
Dan

Hide empty messages

showErrors adds all messages to the errorList, but can we not do this for empty messages? Something like
if (errors[name]) {
this.errorList.push({
message: errors[name],
element: this.findByName(name)[0]
});
}

and also for formatAndAdd:
if (message) {
this.errorList.push({
message: message,
element: element
});
}

Using own metadata in className leads to Error

If, for example, I have this situation:

...input name="hello" class="required {width:120} anotherclass" maxlength="20" type="text"...

, when you make $form.validate().form() an ERROR arise. It gets 3 "rules": "required" (ok), "maxlength" (ok) and "width" ?? (wrong)
which, obviously, should be avoided (it is for other purpose).

So, it filters normal anonymous classNames correctly ( "anotherclass" ) but metadata anonymous classNames wrongly ( "{width:120}" ).

Removing a Rule does not remove all associated messages.

I have a form with this default rule:

rules: {
    sPropertySearchText: {
        required: function(element){
        return isSearchTextRequired();
    },
    minlength: 3
},
messages: {
    sPropertySearchText: { required: "You must enter a minimum of 3 characters or use at least one of the drop down filters to search." }
}

I then have a .change() on another field that alters the rules on sPropertySearchText:

$_sPropertySearchType.change(function(){
    $('span#propertySearchErrors ul').children().remove().end(); /* clear current error messages */
    if ($(this).val() === "zip_code") {
        $_sPropertySearchText.rules('remove');
        $_sPropertySearchText.rules('add', {
            required: true,
            USzip: true,
            minlength: 5,
            maxlength: 5,
            messages: {
                required: "You must enter 5 digit zip code to search.",
                minlength: "Please enter at least 5 digits.",
                maxlength: "Please enter no more than 5 digits."
            }
        });
    } else {
        $_sPropertySearchText.rules('remove');
        $_sPropertySearchText.rules('add', {
            required: function(element){ return isSearchTextRequired(); },
            minlength: 3,
            messages: { 
                required: "You must enter a minimum of 3 characters or use at least one of the drop down filters to search."
            }
        });
    }
});

When I switch from "loan_number" to "zip_code", the validation switches correctly. However, when I switch back to "loan_number", the messages for "minlength" and "maxlength" for "zip_code" still exist in the message object, but not in the rule object. Now if I enter 2 characters into the text field, I get the "minlength" message for "zip_code" instead of the default "minlength" message. The only way to override this is the add a "minlength" message in the "else".

looking for rules using attr is slow

With large forms and IE it makes a noticeable performance improvement to not check attr for rules. Maybe it can be an option to turn off attr rules?

Change $([]).add(this.currentForm.elements) to $($.makeArray(this.currentForm.elements))

I have been debugging a performance problem with large forms in IE. One part that was taking a lot of time was Line 434 in the elements function. A jQuery array is made from the elements attribute of the form:
$([]).add(this.currentForm.elements)

changing to:
$( $.makeArray(this.currentForm.elements))

makes it way faster (in my particular test case elements went from taking 3767ms to 692ms because makeArray takes 1ms instead of 3085ms for add).

This is an alternative work around from the issue linked just prior to the $([]).add line: http://bugs.jquery.com/ticket/2114

remote validation prevents submit

When I enter something valid in a remote validation field, then immediately click on the submit button without hitting tab, the form does not submit. I have to click submit again!

This happens in Firefox 3.0 and 3.6 and in Chrome but not in IE 8.

I think there is some sort of race condition involving validator.pendingRequest but I'm not sure.

To recreate, try this contact form:
http://www.simplyvoting.com/website.php?mode=contact
Enter x as subject and as message
Then enter a valid email (remotely validated).
Click submit.
Nothing happens, click submit again!

numberOfInvalids() doesnt account for groups

For example:

  1. There are 3 required fields on a form.
  2. 2 of them are grouped using the groups option
    *This causes 2 errors to be displayed

Calling numberOfInvalids() in invalidHandler returns 3 (there were indeed 3 total errors), but only 2 errors are displayed.

I think there needs to be a way to get the number of errors that are displayed to the user.

validation does not work when textbox value is programmatically set

Given a form with two textboxes (as a simple example of the issue)
When the first textbox has a class of 'required'
And the second textbox's value has been set programmatically
Then validation on the first textbox should happen
BUT IT DOES NOT!

Below is a sample HTML to illustrate the issue. Follow the instructions at the bottom to manually reproduce the issue.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>

<script type="text/javascript">
    $(document).ready(function () {

        $("#myForm").validate();

        $('#text2').val('2');  // this causes validation of #text1 not to happen

        $('#text2').focus();

    });
</script>

<form id="myForm" action="">

    <label for="text1">Text 1 *</label>
    <input id="text1" name="text1" class="required" type="text" />
    <br/>

    <label for="text2">Text 2</label>
    <input id="text2" name="text2" type="text" />
    <br/>

</form>

<h1>Instructions</h1>
<para>
    Because the JavaScript programmatically sets the value of Text 2, jquery.validate doesn't properly validate the required field Text 1.
    <br/><br/>
    (1) Focus should automatically be on Text 2<br/>
    (2) Press Shift-Tab to put focus on Text 1 (or use the mouse)<br/>
    (3) Type 'a' and then press Tab to put focus on Text 2<br/>
    (4) Press Shift-Tab to put focus back on Text 1 (or use the mouse)<br/>
    (5) Press Backspace to clear out the value in Text 1<br/>
    (6) At this point, the validation message should occur, but it doesn't!<br/>
    <br/>
    Comment out the JavaScript line "$('#text2').val('2');" and try the test again... validation will work.
</para>

remote method need to support a string error message to be returned

The remote method documentation suggest that the remote validation method can return a true/false/'a string message' as the return value'

The response is evaluated as JSON and must be true for valid elements, and can be any false, undefined or null for invalid elements, using the default message; or a string, eg. "That name is already taken, try peter123 instead" to display as the error message.

But since the ajax request is based on dataType: json, if we return a string as the response then the parseJSON ajaxConverter will fail with an exception(invalid json format).

Can we fix this issue?

As I can see we can either change dataType configuration as dataType: "text" and var valid = response === true; to var valid = response == "true"; OR override the text json data converter for this request as

converters : {
"text json" : function(data) {
return data == "true"
? true
: data
}
}

Can we go ahead with these changes?

Thank you.

resetForm should call unhighlight

Guys, dont you think the reset form should call the unhighlight method for each element?

Instead of

this.elements().removeClass( this.settings.errorClass ); // on line 381

do

var elements = this.elements();
for (var i = 0; i &lt; elements.length; i++){
    this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass);
}

Please comment if i undestood wrong the usage of highlight and unhighlight.

bug

hi,this is a bug.

$('#frm-login').validate({
    errorClass : 'error text'   //when not one class,create more errorlabel
    ,submitHandler : function(frm){
        return false;
    }
});

Provide access to element in success() callback

It's good to have the label but it will be more logical for success to behave as errorPlacement and provide two arguments: error and element.

An example scenario where this is useful is when qTip is used to display errors. Then the developer will have to hide them in success but in order to access the qTip API we need to find the form element it's assigned to.

presence of submitHandler causes custom handler to be run for cancel button

If I have a button with class cancel,the submitHandler I provided to validate gets called when it is clicked. I find it very puzzling - since it is not suposed to be doing validation, it should not call my handler but just return true:

if ( validator.cancelSubmit ) {
validator.cancelSubmit = false;
return handle();
}

support for jquery-glob

It would be nice if jquery-validations's built-in validators could leverage the functions provided by jquery-glob, e.g. the date() validator could call jquery-glob's parseDate() internally to see if the supplied date is valid in the current culture setting.

Same goes for the parsing of numbers or timestamps.

Incorrect behavior with a non-required field and overridden message handlers

I have the following form:

<form>
    <p>
        <label for="cname">Name</label>
        <input id="cname" name="name" />
    </p>
    <p><input type="submit" value="Create" /></p>
</form>
<table id="log" cellpadding="2" cellspacing="0" border="1"></table>

<script>
    function onError(error, inputElement) {
        var logMsg = $("<tr><th>onError</th><td></td></tr>");
        logMsg.find("td").html(error.clone());
        $("#log").append(logMsg);
    }

    function onErrors(form, validator) {
        var logMsg = $("<tr><th>onErrors</th><td></td></tr>"),
            logTd = logMsg.find("td");

        $.each(validator.errorList, function () {
            logTd.append("<div>" + this.message + "</div>");
        });
        $("#log").append(logMsg);
    }

    function onSuccess(error) {
        var logMsg = $("<tr><th>onSuccess</th><td></td></tr>");
        logMsg.find("td").html(error.clone());
        $("#log").append(logMsg);
    }

    $(function() {
        $("form").validate({
            errorPlacement: onError,
            invalidHandler: onErrors,
            success: onSuccess
        });
        $("#cname").rules("add", {"maxlength": 25});
    });
</script>

When I run this form and type more than 25 characters into the box, then tab away, I get a call to onError as I'd expected. If I then delete characters one at a time until I have less than 25, I get calls to onError and onSuccess as I expect (which tells me to clear the error message).

Refresh the page and start over. Again, type more than 25 characters into the box and tab away, and see the call to onError. This time, highlight the entire block of text and hit the delete key. Instead of seeing the calls to onError and onSuccess as I'd expect, I see no calls at all.

Stepping into check() function, it would appear that the logic for dependency mismatch is causing my problem. jQuery Validate keeps two lists: errorList and successList. Inside of check(), if you have not failed validator, but your last validator returns "dependency-mismatch" (a common scenario when you are validated but not required), then the element ends up in neither errorList nor successList. At the end of check(), you can see that dependencyMismatch being true short-circuits putting the otherwise valid element into successList.

I can work around this bug by adding a dummy validator (which always returns true) and making sure that validator is last in my list:

    $.validator.addMethod("__dummy", function (value, element, params) {
        return true;
    });

    $(function() {
        $("form").validate({
            errorPlacement: onError,
            invalidHandler: onErrors,
            success: onSuccess
        });
        $("#cname").rules("add", {"maxlength": 25, "__dummy": true});
    });

Note that the dummy validator has to come last in the list, since we need to ensure that the dependencyMismatch flag ends up false instead of true.

Possibility to custom overrule the showLabel method

Hi, first; great plugin! Use it a lot...

I have some issues with the placement of the error label. With errorPlacement I could determine the position of the error label, either I not only want to change the placement but it should be cool when I could overrule / hook into the showLabel method.

For a lot of websites I had to use this plugin and creates fields with an error or okay icon behind the field. No problem for that, Only now I want to try to set the error as title for the label element and for the field itself. With errorPlacement I could do this for the first time the error shown but in the case of more validations on one field, like an email field, I want to change the label.html(message); in showLabel into something else, to replace the title attribute

Maybe a good new feature? This one could also be used for custom tooltips or something else then.

small regex bug in number check

Validator with {number: true} rejects floats without the leading 0 (e.g. ".3").

Current version and fixed version respectively (line 1022):
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:.\d+)?$/.test(value);
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:.\d+)?$/.test(value);

-Ben

depency-mismatch

In a form with the rule set all set in json rules option, I have an input that is optional with no record in rules but has a maxLength='45', the plugin seems to pick this up and add a rule for it, which is fine but .valid() returns 0 (invalid) on the element.

railujs driver + jquery-validation + ajax form - causes validation to be silently ignored (only IE)

when using jquery UJS driver (most recent) and an ajax form (via the data-remote tag), the validation rules are silently ignored. only in IE 8, chrome and FF work fine

tested with jquery 1.4.4 and jquery 1.5.1, using most recent jquery-validation from github.

here is a simple example:
http://avioing.com/validate/example.html and
http://avioing.com/validate/example_no_ujs.html
the only difference between the two files is that i removed "data-remote" tag from the form in the latter file, and now validation is triggered.

submitHandler return value is unused

The current code for the submitHandler is
validator.settings.submitHandler.call( validator, validator.currentForm );

And it always returns false, but I have a use case where I would want my submitHandler to let it return true.

My suggestion would be to instead have your code look like this:
var result = validator.settings.submitHandler.call( validator, validator.currentForm );
// other stuff before return false;
if (result !== undefined) {
return result;
} else {
return false;
}

Performance of validate can be improved on large pages simply

On large pages, the validate method runs slow. I am not positive on why but the lines:

this.find("input, button, a").filter(".cancel").click(function() {
  validator.cancelSubmit = true;
});

Can be improved to run in 1/2 the time with two separate finds added together.

var inputs = this.find("input");
var buttons = this.find("button");
inputs.add(buttons).filter(".cancel").click(function() {
    validator.cancelSubmit = true;
});

Remote validation kills local validation

I have a couple of controls that are validated via a remote option. The 'success' function calls validator.prepareElement(element), which clears the error list.

I've tracked this bug down by changing a line in jquery.validate.js:918 (the start of the 'remote' function). When I return 'true' there, all the local errors show up. When I let the remote function do its job, the error list gets erased, and then the form is declared 'valid'.

element.value used instead of $(element).val()

There are 2 places (in the current version) where element.value is used to get the value of an element rather than the jquery way of $(element).val().

There are some plugins which replace the val function (or chain it) in order to alter the value returned by the val function, but these plugins are bypassed by accessing the value property directly.

An example of why you would want to use val instead of the value property is the placeholder plugin, designed to emulate the watermarking feature of html5 browsers; it replaces the val function with it's own function (which in turn calls the original val), but it ensures you never get the value of the placeholder text, instead returning an empty string if the text box only contains placeholder text

Easy to fix by replacing the 2 occurences of element.value and the 2 occurences of a.value if you think it is worthwhile to do so!

Regards

Issue 11 not solved as stated in Changelog

Dear author,

The fix of remote validation is still not functioning, I suggest you use this piece of code, which solves it:

var message = (previous.message = response || validator.defaultMessage( element, "remote" ));
errors[element.name] = $.isFunction(message) ? message(value) : message;message(value) : message;

Reminder of issue:
form not submitting on remote validation like captcha check.

Thanks,
Marcin

Adding the errorClass to an elements hides it

I'm using the highlight() method to add the errorClass to the label as well as to the invalid element, like in the second example of the highlight method: http://docs.jquery.com/Plugins/Validation/validate#toptions.

So, if I submit the form with errors, the input and the label are now in red ... But if I submit it again, some labels disappear!

Here is a testcase: http://yann.universfantastiques.org/tests/jquery-validator/ where you can see the form and the js (validator options) I use.

You can see the label "Cochez cette case si vous n'avez pas de domaine chez Gandi" disappear if you hit 2 times the Enter key.
I you select "Hébergement" from the first select, you can see the same appens to the "Cochez cette case si vous n'avez pas encore de serveur" label!

I have no idea why the hideErrors() method is called! :-/

Won't validate onkeypress/focusout

After looking more carefully, I still cannot get validation to occur on keypress or on focusout.

My code is here: https://gist.github.com/704040. I tested the examples in FF/Chrome/Opera/IE7 on XP.

I see this warning in console: The 'charCode' property of a keyup event should not be used. The value is meaningless.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.