Webwork client JavaScript validator (webwork validation)

Source: Internet
Author: User
For the latest download, visit http://ww2validator.dev.java.net
Webwork2 extended validator instructions

1. Download and decompress the file

2. Find jscud_wwvalidators_1 _??. Jar, modify the classpath or copy it to the corresponding path

3. Copy the checkform. js file to your project and then reference

There are two methods to reference

I: Reference checkform. js directly in your program (note that you need to modify the path)

<Script language = "JavaScript" src = "checkform. js"> </SCRIPT>

II: Modify/reload the form-close.vm, reference or include checkform. js. See the webwork documentation.

For example, add: # parse ("/template/XXX/checkform. js ")

Or
<Script language = "JavaScript" src = "$ Req. contextpath/JS/checkform. js"> </SCRIPT>
# Parse ("/template/simple/form. VM ")
<Table class = "wwformtable">

4. Modify Your validators. xml

NOTE: For the multi-language String Length checker, you can only use one of them for one project. It can be set based on your storage situation. You can also set it during installation. (This is inconvenient, but there may be no choice)

See validators in the test directory.

5. Modify the validation file XXXAction-validation.xml or XXXAction-Alias-validation.xml

Refer to the TestAction-doAdd-validation.xml under the test directory

 

Validator list

Server Side validator Client JavaScript validator Desc Parameter Memo
Requiredstringvalidator Jsrequiredstringvalidator Required string validator
  • Trim
Javascript deal trim
Stringlengthfieldvalidator Jsstringlengthfieldvalidator String Length validator
  • Trim
  • Minlength
  • Maxlength
 
Integervalidator Jsintegervalidator Int validaotr
  • Maxnum
  • Minnum
  • Datatype
Javascript check validity
Floatvalidator Jsfloatvalidator Float validator
  • Maxnum
  • Minnum
 
Longvalidator - Long validator
  • Maxnum
  • Minnum
 
Emailvalidator Jsemailvalidator Email validator - Javascript change
Urlvalidator Jsurlvalidator URL validator -  
Abclettervalidator Jsabclettervalidator 26 letters validator -  
Basewordvalidator Jsbasewordvalidator Base ASCII letter validator -  
Customdataregexpvalidator Jscustomdataregexpvalidator Custom Reg express validator Regexp  
         
         
String storage length validator
One2onesavestringlengthfieldvalidator Jsone2onesavestringlengthfieldvalidator One-> one
  • Trim
  • Minlength
  • Maxlength
 
One2twosavestringlengthfieldvalidator Jsone2twosavestringlengthfieldvalidator One-> two
  • Trim
  • Minlength
  • Maxlength
 
One2threesavestringlengthfieldvalidator Jsone2threesavestringlengthfieldvalidator One-> three
  • Trim
  • Minlength
  • Maxlength
 
         

Blue class: webwork class, not belong This Lib.

Red class: webwork exist same class, this lib improve it or change it.

Related Article

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.