summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/js/validator.js
diff options
context:
space:
mode:
authorxue <>2006-04-28 11:10:06 +0000
committerxue <>2006-04-28 11:10:06 +0000
commit2cc93773feb5e76d2dd002b1dcd463a01d606794 (patch)
treec3615e1183fa6db678dbdf08b07c25543a2cde09 /framework/Web/Javascripts/js/validator.js
parent1f63d5c05ba117e0158c02d5bc79fa1f38f8ce85 (diff)
Merge from 3.0 branch till 985.
Diffstat (limited to 'framework/Web/Javascripts/js/validator.js')
-rw-r--r--framework/Web/Javascripts/js/validator.js61
1 files changed, 42 insertions, 19 deletions
diff --git a/framework/Web/Javascripts/js/validator.js b/framework/Web/Javascripts/js/validator.js
index 5e23df50..88dfb25e 100644
--- a/framework/Web/Javascripts/js/validator.js
+++ b/framework/Web/Javascripts/js/validator.js
@@ -156,41 +156,45 @@ Prado.WebUI.TValidationSummary.prototype =
group : null,
options : {},
visible : false,
-summary : null,
+messages : null,
initialize : function(options)
{
this.options = options;
this.group = options.ValidationGroup;
-this.summary = $(options.ID);
-this.visible = this.summary.style.visibility != "hidden"
-this.visible = this.visible && this.summary.style.display != "none";
+this.messages = $(options.ID);
+this.visible = this.messages.style.visibility != "hidden"
+this.visible = this.visible && this.messages.style.display != "none";
Prado.Validation.addSummary(options.FormID, this);
},
updateSummary : function(validators, update)
{
if(validators.length <= 0)
-return this.hideSummary(update);
+{
+if(update || this.options.Refresh != false)
+{
+return this.hideSummary(validators);
+}
+return;
+}
var refresh = update || this.visible == false || this.options.Refresh != false;
if(this.options.ShowSummary != false && refresh)
{
-this.displayHTMLMessages(this.getMessages(validators));
-this.visible = true;
+this.updateHTMLMessages(this.getMessages(validators));
+this.showSummary(validators);
}
if(this.options.ScrollToSummary != false)
-window.scrollTo(this.summary.offsetLeft-20, this.summary.offsetTop-20);
+window.scrollTo(this.messages.offsetLeft-20, this.messages.offsetTop-20);
if(this.options.ShowMessageBox == true && refresh)
{
this.alertMessages(this.getMessages(validators));
this.visible = true;
}
},
-displayHTMLMessages : function(messages)
+updateHTMLMessages : function(messages)
{
-this.summary.show();
-this.summary.style.visibility = "visible";
-while(this.summary.childNodes.length > 0)
-this.summary.removeChild(this.summary.lastChild);
-new Insertion.Bottom(this.summary, this.formatSummary(messages));
+while(this.messages.childNodes.length > 0)
+this.messages.removeChild(this.messages.lastChild);
+new Insertion.Bottom(this.messages, this.formatSummary(messages));
},
alertMessages : function(messages)
{
@@ -208,15 +212,28 @@ messages.push(message);
})
return messages;
},
-hideSummary : function(refresh)
+hideSummary : function(validators)
+{if(typeof(this.options.OnHideSummary) == "function")
{
-if(refresh || this.options.Refresh != false)
+this.messages.style.visibility="visible";
+this.options.OnHideSummary(this,validators)
+}
+else
{
+this.messages.style.visibility="hidden";
if(this.options.Display == "None" || this.options.Display == "Dynamic")
-this.summary.hide();
-this.summary.style.visibility="hidden";
-this.visible = false;
+this.messages.hide();
}
+this.visible = false;
+},
+showSummary : function(validators)
+{
+this.messages.style.visibility="visible";
+if(typeof(this.options.OnShowSummary) == "function")
+this.options.OnShowSummary(this,validators);
+else
+this.messages.show();
+this.visible = true;
},
formats : function(type)
{
@@ -330,6 +347,7 @@ if(this.isValid)
if(typeof(this.options.OnSuccess) == "function")
{
this.visible = true;
+this.message.style.visibility = "visible";
this.updateControlCssClass(this.control, this.isValid);
this.options.OnSuccess(this, invoker);
}
@@ -341,6 +359,7 @@ else
if(typeof(this.options.OnError) == "function")
{
this.visible = true;
+this.message.style.visibility = "visible";
this.updateControlCssClass(this.control, this.isValid);
this.options.OnError(this, invoker);
}
@@ -415,6 +434,10 @@ getValidationValue : function(control)
this.observeDatePickerChanges();
return Prado.WebUI.TDatePicker.getDropDownDate(control).getTime();
}
+ case 'THtmlArea':
+ if(typeof tinyMCE != "undefined")
+tinyMCE.triggerSave();
+return this.trim($F(control));
default:
if(this.isListControlType())
return this.getFirstSelectedListValue();