jstl页面校验的用法[15]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 heya001 的 blog

object compatiblity

input type=text, input type=password, textarea

 

   3. if you want to validate the relationship between two fields, you should provide the methods by yourself. the validate.js will provide the method to define the error message and some methods to help you do that, such as constructdate, commonvalidatenumberr. if self defined validation is used in several jsps, you can put these validations into commonvalidation.js file. here is the method lists:

   methods used to process error:

      1) errorprocess(errorfield, errormessage)

         description: write the errormessage in the specified division by yourself and tell user which field data is invalid;

parameters: errorfield the name of error elements, you can pass one element name, or a array of element name;

errormessage the displayed message;

         return: void;

         example: show as below;

     

      2) checkerror(form)

         description: check the array which contains the error fields, if the array is empty,

return true, else return false;

         parameters: form the name of form;

         return: true or false;

         example:show as below;

 

  methods used to help you apply self defined validation rules:

     1)  commonvalidatenumberr(field,lb,ub)

    description: valid integers within specified bounds;

          parameters: field the data you wanna validate

                    lb the minimum number

                    ub the maximum number;

          return: true or false;

          example: commonvalidatenumberr(hour,0,23), if hour < 0 or hour > 23, return false, else return ture;

2)       constructdate(dayobj,monthobj,yearobj)

     description: construct the date obj according the input field data;

本文关键:jstl页面校验的用法
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top