Changeset 2333
- Timestamp:
- 06/23/09 20:45:18 (13 months ago)
- Location:
- coldbox/trunk
- Files:
-
- 2 modified
-
system/plugins/Validator.cfc (modified) (3 diffs)
-
testing/cases/plugins/ValidatorTest.cfc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
coldbox/trunk/system/plugins/Validator.cfc
r2332 r2333 10 10 An incredible validator for all the following: 11 11 12 Validations (Can be a list):12 Validations: 13 13 - boolean 14 14 - date … … 27 27 - string 28 28 - telephone 29 - udf-{UDF Method}30 29 - URL 31 30 - uuid … … 108 107 function checkTelephone(str){ return isValid("telephone",arguments.str); } 109 108 110 function checkWithUDF(str,udf){111 var udfCall = arguments.udf;112 return udfCall(arguments.str);113 }114 115 109 function checkURL(str){ return isValid("URL",arguments.str); } 116 110 -
coldbox/trunk/testing/cases/plugins/ValidatorTest.cfc
r2332 r2333 8 8 Date : 06/18/2009 9 9 Description : 10 An incredible validatoridator for all the following: 11 12 validatoridations (Can be a list): 13 - boolean 14 - date 15 - email 16 - eurodate 17 - exactLen-X 18 - numeric or float 19 - guid 20 - integer 21 - maxLen-X 22 - minLen-X 23 - range-1..4 24 - regex-{regexhere} 25 - sameAs-{fieldname} 26 - ssn 27 - string 28 - telephone 29 - udf-{UDF Method} 30 - URL 31 - uuid 32 - USdate: a U.S. date of the format mm/dd/yy, with 1-2 digit days and months, 1-4 digit years. 33 - zipcode 5 or 9 digit format zip codes 34 10 Test 35 11 -----------------------------------------------------------------------> 36 12 <cfcomponent extends="coldbox.system.testing.BaseTestCase"> … … 135 111 } 136 112 137 function testcheckWithUDF(){138 assertTrue( validator.checkWithUDF(true,variables.myUDF) );139 assertFalse(validator.checkWithUDF('2342-asb',variables.myUDF) );140 }141 142 113 function testcheckURL(){ 143 114 assertTrue( validator.checkURL('http://www.coldbox.org') ); … … 165 136 } 166 137 </cfscript> 167 168 <cffunction name="myUDF" access="private" returntype="boolean">169 <cfargument name="str" type="string" required="true" default="" hint=""/>170 <cfreturn isBoolean(arguments.str)>171 </cffunction>172 138 </cfcomponent>
