summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/js/debug
diff options
context:
space:
mode:
authorwei <>2006-09-01 01:07:51 +0000
committerwei <>2006-09-01 01:07:51 +0000
commit769856093ded9e4aae341a7d79b7f1441e7d5478 (patch)
treeba3e04abf5f73deed023bab7ec95b9b245dfcb22 /framework/Web/Javascripts/js/debug
parent47a3cb88e7ed7f2a87bbf024dff3416fc6cd8002 (diff)
Add TActiveCustomValidator
Diffstat (limited to 'framework/Web/Javascripts/js/debug')
-rw-r--r--framework/Web/Javascripts/js/debug/validator.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/framework/Web/Javascripts/js/debug/validator.js b/framework/Web/Javascripts/js/debug/validator.js
index ec57e876..72d9a01d 100644
--- a/framework/Web/Javascripts/js/debug/validator.js
+++ b/framework/Web/Javascripts/js/debug/validator.js
@@ -1100,6 +1100,45 @@ Prado.WebUI.TCustomValidator = Class.extend(Prado.WebUI.TBaseValidator,
}
});
+Prado.WebUI.TActiveCustomValidator = Class.extend(Prado.WebUI.TBaseValidator,
+{
+ validatingValue : null,
+ requestDispatched : false,
+
+ /**
+ * Calls custom validation function.
+ */
+ evaluateIsValid : function()
+ {
+ value = this.getValidationValue();
+ if(!this.requestDispatched && value != this.validatingValue)
+ {
+ this.validatingValue = value;
+ request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ request.setParameter(value);
+ request.setCausesValidation(false);
+ request.options.onSuccess = this.callbackOnSuccess.bind(this);
+ request.options.onFailure = this.callbackOnFailure.bind(this);
+ request.dispatch();
+ this.requestDispatched = true;
+ return false;
+ }
+ return this.isValid;
+ },
+
+ callbackOnSuccess : function(request, data)
+ {
+ this.isValid = data;
+ this.requestDispatched = false;
+ Prado.Validation.validate(this.options.FormID, this.group,null);
+ },
+
+ callbackOnFailure : function(request, data)
+ {
+ this.requestDispatched = false;
+ }
+});
+
/**
* TRangeValidator tests whether an input value is within a specified range.
*