Dojo
发布时间:2022-04-21 发布网站:大佬教程 code.js-code.com
大佬教程收集整理的这篇文章主要介绍了dojo验证函数,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
dojo提供了几乎全方位的验证
函数,在使用下面的
方法之前,要通过类似下面的语句引入dojo的相关库,如
<script src="/js/dojo/dojo.js"></script> <script type="text/javas cript"> dojo.
require("dojo.validate"
); dojo.
require("dojo.validate.
check"
); dojo.
require("dojo.widget.Dialog"
); </script>
如果不确定要引入哪些validate,可以在dojo的源@L_
696_2@包的src中寻找一下。
value:
value to test.
returns:
value:
value to test.
returns:
value:
value to test.
returns:
isEmailAddress(value,allowLocal,allowCruft):
isEmailAddress deter
mines if value is an email address,with var
IoUs levels of
Strict
ness in its validation.
value:
value to test.
allowLocal:
returns:
isEmailAddressList(value,allowCruft):
isEmailAddress deter
mines if a list of potential values are email addresses,with var
IoUs levels of
Strict
ness in its validation.
value:
comma separated list of values to test.
allowLocal:
allowCruft:
returns:
isValidDate(dateValue,format):
isValidate deter
mines if a date is valid under the specified format,or a default format of MM/DD/YYYY if not is specified.
dateValue:
value to test.
format:
format to test
Accepts many format types,including ISO8601 and RFC3339. All characters in the format
String are treated literally except the following tokens: YYYY - matches a 4 digit year M - matches a non zero-padded month MM - matches a zero-padded month D - matches a non zero-padd
ed date DD - matches a zero-padd
ed date DDD - matches an ordinal date,1-365,and 366 on leapyear ww - matches week of year,1-53 d - matches day of week,1-7
Examples:
these are all equivalent to October 19,2005:
Date Format 2005-W42-3 YYYY-Www-d 2005-292
YYYY-DDD 20051019 YYY
ymMDD 10/19/2005 M/D/YYYY 19.10.2005 D.
m.YYYY
returns:
is24HourTime accepts a parameter,and deter
mines if
it is a valid 24 hour
time.
value:
value to test.
returns:
is12HourTime accepts a parameter,and deter
mines if
it is a valid 12 hour
time.
value:
value to test.
returns:
(IPv6 is not currently supported)
value:
value to test.
returns:
isUrl accepts a parameter,and deter
mines if
it is a valid url,based on
either a domain name or IP addres
s. (IPv6 is not currently supported)
value:
value to test.
returns:
isCurrency accepts a parameter,and deter
mines if
it is a valid US currency.
Supports optional plus/minus sign,optional dollar-sign,optional cents,optional comma
s.
value:
value to test.
returns:
isPhone
number accepts a parameter,and deter
mines if
it is a valid US
phone
number. Support 4 common separators (none,space,-,and .). Need to add support for extension
s.
value:
value to test.
returns:
US Social S
ecurity number. Supports space,or no separator.
value:
value to test.
returns:
isZipCode accepts a parameter,and deter
mines if
it is a valid US zip code.
Supports space,or no separator
between base and optional +4 portion of US zip code.
value:
value to test.
returns:
isState accepts a two character parameter,and deter
mines if
it is a valid
postal abbreviation for a US state or territory.
value:
value to test,2 digit character represen
Ting a postal abbreviation.
returns:
大佬总结
以上是大佬教程为你收集整理的dojo验证函数全部内容,希望文章能够帮你解决dojo验证函数所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。