diff options
author | ctrlaltca@gmail.com <> | 2011-12-19 13:20:38 +0000 |
---|---|---|
committer | ctrlaltca@gmail.com <> | 2011-12-19 13:20:38 +0000 |
commit | e542ea49ceb77ad48f144a9f4ab1eaaafe4dc198 (patch) | |
tree | fcb0547f1128b705b828a59d4ac8f7c9222bbe02 /framework/Web/Javascripts | |
parent | c35b6041631a11aa7ba822d03b3ad13794db17f9 (diff) |
committed patch from #378
Diffstat (limited to 'framework/Web/Javascripts')
-rw-r--r-- | framework/Web/Javascripts/source/prado/validator/validation3.js | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/framework/Web/Javascripts/source/prado/validator/validation3.js b/framework/Web/Javascripts/source/prado/validator/validation3.js index c0f770cf..bbf3929a 100644 --- a/framework/Web/Javascripts/source/prado/validator/validation3.js +++ b/framework/Web/Javascripts/source/prado/validator/validation3.js @@ -790,7 +790,6 @@ Prado.WebUI.TBaseValidator.prototype = options.OnSuccess = options.OnSuccess || Prototype.emptyFunction;
options.OnError = options.OnError || Prototype.emptyFunction;
*/
-
/**
* Wether the validator is enabled (default true)
* @var {boolean} enabled
@@ -839,6 +838,9 @@ Prado.WebUI.TBaseValidator.prototype = this.message = $(options.ID);
Prado.Registry.set(options.ID, this);
+
+ if (this.onInit) this.onInit();
+
if(this.control && this.message)
{
this.group = options.ValidationGroup;
@@ -1940,3 +1942,44 @@ Prado.WebUI.TCaptchaValidator = Class.extend(Prado.WebUI.TBaseValidator, return crc ^ (-1);
}
});
+
+
+/**
+ * TReCaptchaValidator client-side control.
+ *
+ * @class Prado.WebUI.TReCaptchaValidator
+ * @extends Prado.WebUI.TBaseValidator
+ */
+Prado.WebUI.TReCaptchaValidator = Class.extend(Prado.WebUI.TBaseValidator,
+{
+ onInit : function()
+ {
+ var obj = this;
+ var elements = document.getElementsByName(this.options.ResponseFieldName);
+ if (elements)
+ if (elements.length>=1)
+ {
+ Event.observe(elements[0],'change',function() { obj.responseChanged() });
+ Event.observe(elements[0],'keydown',function() { obj.responseChanged() });
+ }
+ },
+
+ responseChanged: function()
+ {
+ var field = $(this.options.ID+'_1');
+ if (field.value=='1') return;
+ field.value = '1';
+ Prado.Validation.validateControl(this.options.ID);
+ },
+
+ /**
+ * Evaluate validation state
+ * @function {boolean} ?
+ * @return True if the captcha has validate, False otherwise.
+ */
+ evaluateIsValid : function()
+ {
+ return ($(this.options.ID+'_1').value=='1');
+ }
+});
+
|