/source/Plug-in/ext/adv-vtypes.js

http://prosporous.googlecode.com/ · JavaScript · 45 lines · 29 code · 4 blank · 12 comment · 12 complexity · fde2ca9168c033dc0455f759fceee4b1 MD5 · raw file

  1. /*
  2. * Ext JS Library 2.2
  3. * Copyright(c) 2006-2008, Ext JS, LLC.
  4. * licensing@extjs.com
  5. *
  6. * http://extjs.com/license
  7. */
  8. // Add the additional 'advanced' VTypes
  9. Ext.apply(Ext.form.VTypes, {
  10. daterange : function(val, field) {
  11. var date = field.parseDate(val);
  12. if(!date){
  13. return;
  14. }
  15. if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {
  16. var start = Ext.getCmp(field.startDateField);
  17. start.setMaxValue(date);
  18. start.validate();
  19. this.dateRangeMax = date;
  20. }
  21. else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {
  22. var end = Ext.getCmp(field.endDateField);
  23. end.setMinValue(date);
  24. end.validate();
  25. this.dateRangeMin = date;
  26. }
  27. /*
  28. * Always return true since we're only using this vtype to set the
  29. * min/max allowed values (these are tested for after the vtype test)
  30. */
  31. return true;
  32. },
  33. password : function(val, field) {
  34. if (field.initialPassField) {
  35. var pwd = Ext.getCmp(field.initialPassField);
  36. return (val == pwd.getValue());
  37. }
  38. return true;
  39. },
  40. passwordText : '????????'
  41. });