PostalCodeValidator.js 496 B

1234567891011121314151617181920212223242526272829
  1. define( function() {
  2. "use strict";
  3. function PageModule()
  4. {
  5. };
  6. function myPostalCodeValidator( re, aValues )
  7. {
  8. var iLength = aValues.length;
  9. for ( var i = 0; i < iLength; i++ )
  10. {
  11. var s = aValues[i].use;
  12. if ( !s || !s.match( re ) )
  13. {
  14. return false;
  15. }
  16. }
  17. return iLength > 0;
  18. }
  19. PageModule.prototype.load = function( Page1 )
  20. {
  21. Page1.getControlByName( "txtPostalCode" ).setValidator( myPostalCodeValidator.bind( null, /^[A-Z][0-9][A-Z] [0-9][A-Z][0-9]$/));
  22. };
  23. return PageModule;
  24. });