Jquery form verification, jquery form

Source: Internet
Author: User

Jquery form verification, jquery form

1, first need to import js package and css package: http://download.csdn.net/detail/l294333475/7816951

2. index. jsp (test page)

<% @ Page language = "java" import = "java. util. * "pageEncoding =" UTF-8 "%> <% String path = request. getContextPath (); String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path + "/"; %> <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN"> Validate. js: (you can modify it as required)

$ (Document ). ready (function () {/*** validation information validation */jQuery ("# checkInfoForm "). validationEngine ();/*** user-defined information verification */jQuery ("# applyForm "). validationEngine ({'m M _ error_messages ': {' # txtKeyNum ': {'Min': {'message': "Enter at least one electronic key "}}, '# fileseal': {'required': {'message': "upload a seal image file" }},' # filesign': {'required ': {'message': "upload a signed image file "}}}});});




Jquery Form Verification plug-in

ByteRange: [, 'utf-8']. This rule is not found in the API. It should be your custom validation rule. Make sure that it is successfully defined:

JQuery. validator. addMethod ("byteRange", function (value, element, param ){
//
}, $. Validator. format ("..."));

During the test, I took the byteRange: [3, 15, 'utf-8'] sentence and verified it successfully.

Jquery verifies the form and submits it if it fails to pass the verification. How can this problem be solved?

First: submit with js, submit-button
Second. Check it.
$ ("# TxtName"). blur (function () {-- this sentence is☞The event triggered when the text box loses focus, right.

Onsubmit = "return blur ()"--☞Method

Changed to function blur (){
Then copy the verification code.
}
Then. $ ("# txtName"). blur (function () {blur () ;});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.