This article to share based on jquery implementation of Ajax to verify the existence of the user name implementation code, need the code farmers can refer to the source code of this article.
Jquery.ajax Overview
HTTP requests load remote data.
Implemented through the jquery underlying AJAX. Simple and easy-to-use high-level implementation see $.get, $.post, et
Validation:
Chinese name, cell phone number, ID card and address
HTML (form):
formaction=""> Divclass="Form-group"> label> Name: label> inputId="Name"Type="Text"> Div> Divclass="Form-group"> label> Mobile Number: label> inputId="Phone"Type="Text"> Div> Divclass="Form-group"> label> ID: label> inputId="Identity"Type="Text"> Div> Divclass="Form-group"> labelclass="Label-textarea"> Mailing Address: label> textareaId="Address">textarea> Div> Pclass="Tip"> Please fill in the real name authenticatio
JQuery Ajax displays the check mark and error number to verify that the entered verification code is correct. jqueryajax
If you don't talk much about it, paste the Code directly. The specific code is as follows:
First introduce jquery
.sl-error-verifycode { background-image: url("images/icons.png"); background-position: -26px 0; background-repeat: no-repeat; dis
The examples in this article describe two common methods for jquery to verify that the element is empty. Share to everyone for your reference. Specifically as follows:
The following provides two methods for checking whether the contents of an element of the specified ID are null
Method one
if (!$ (' #jb51 '). HTML ()) {
//http://www.jb51.net nothing found;
}
Method two
if ($ (' #jb51 '). Is (": Empty
This article describes in detail the solution that CKEditor cannot verify and the jQueryValidate verification framework. if you are interested, refer to the front-end of the recent project that uses jQuery, jQuery Validate is used for front-end verification of the form, which is very easy to use and always satisfactory.
Some time ago, we added the html rich text
The function is absolutely realized. Compatible with IE6, IE7, FF, Chrome
The servlet code for Ajaxxmlserver is as follows:
Package com.web;Import java.io.IOException;Import Java.io.PrintWriter;Import javax.servlet.ServletException;Import Javax.servlet.http.HttpServlet;Import Javax.servlet.http.HttpServletRequest;Import Javax.servlet.http.HttpServletResponse;public class Ajaxxmlserver extends HttpServlet {public void doget (HttpServletRequest request, httpservletresponse response)Throws Servlete
JQuery Validate cannot verify the chosen-select Element Solution, jqueryselectchosen
After the chosen-select element executes the chosen () method, it adds style = "display: none;" to the select element to hide it, and re-constructs a drop-down list that looks like select.
By default, jQuery Validate ignores the verification of hidden elements. Therefore, selec
First look at an image:
1. Introduction:
S3captcha is a very useful JQuery plug-in that allows you to display images in sequence. It is implemented through php. However, I found it easy to convert it into asp.net and C # code. I made a config configuration file to configure the source and name of the image in the file.
Next, we will introduce the implementation principle of s3captcha,
Shows its implementation mode.1. The index of the image is genera
Extended textarea attributes, combined with jquery. validate. js, added the length of textarea for verification while submitting the form.
1. jQuery plugin for verifying the length of textarea
Copy codeThe Code is as follows: // verify the textarea Length
JQuery. fn. checkLength = function (parameters ){
Defaults = {
M
Digital Judgment Method: isNaN () function
The test () method determines whether the string matches the contents of the regular expression, and returns a Boolean value (True/false)
Verify that the Chinese name
function ischinaname (name)
{var pattern =/^[\u4e00-\u9fa5]{1,6}$/;
return pattern.test (name);
//Verify the mobile number
function Isphoneno (phone) {
var pattern =/^1[34578]\d{9}$/;
ret
The Textarea control cannot use formvalidate. js to determine the attributes of. Extended textarea. Combined with jquery. validate. js, it also verifies the length of textarea when submitting a form.
1. jQuery plugin for verifying the length of textarea
The Code is as follows:
// Verify the textarea LengthJQuery. fn. checkLength = function (parameters ){Default
Jquery provides an example to verify the size of uploaded files (recommended ).
Jquery verifies the size of uploaded files (recommended)
The above is all the content of the jquery verification example (recommended) for implementing the file upload size type. I hope you can provide more support for the help house ~
, select, textarea"). Not (": Submit,: RESET,: Image, [disabled]"). Not ( This. Settings.ignore). Filter (function() { varElementidentification = This. ID | | This. Name; ! This. Name validator.settings.debug window.console console.error ("%o has no name assigned", This); //Select only the first element for each name, and only those with rules specified if( This. NameinchRulescache | | !validator.objectlength ($ ( This). Rules ()))return false; //Rulescache[this.
to their original status. Otherwise the user does not work, but the error message does not have to ignore him. The errmsg variable will be emptied every time the user clicks the Submit button.3. Use the $ (obj). Find ("input[type= ' text ']"). The each () method iterates through all the single-line text boxes and the rest of the table items are the same. Each () parameter can be a function, and here is our judgment function. The This in this function is the one that iterates through each item.4
method is set. The result is not worth, passed over is a null, so I delete the private variable, and then directly with User.getuserniname () directly obtained. Remember.
UserService (omitted).
User class (omitted).
Userdao:
Package Com.wang.shop.user.dao;
Import java.util.List;
Import Org.springframework.orm.hibernate4.support.HibernateDaoSupport;
Import Com.wang.shop.user.entity.User;
public class Userdao extends hibernatedaosupport{
/**
* Query user's nickname
* @param userniname
Verify the jQuery Validation Engine simple custom regular expression, jqueryvalidation
First on the Control Address http://code.ciaoca.com/jquery/validation-engine/
The specific method of use is clearly stated on the website. I wrote this article mainly to record how to add custom Regular Expressions by myself. This problem has been fixed several times and will b
Http://www.cnblogs.com/wifi/articles/2387131.htmlRefer to jquery FirstHTML Section---------------------------------JS Part------------------------Use jquery to implement a submit form to verify that the text box is empty
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.