From 0301d3a65dec4d4b35d3fe9bfbe33728a4d05f48 Mon Sep 17 00:00:00 2001 From: wei <> Date: Thu, 10 May 2007 03:08:51 +0000 Subject: Fixed #617 --- .gitattributes | 1 + framework/Data/ActiveRecord/TActiveRecord.php | 2 +- .../source/prado/validator/validation3.js | 16 ++++- .../tickets/protected/pages/Ticket617.page | 77 ++++++++++++++++++++++ 4 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket617.page diff --git a/.gitattributes b/.gitattributes index d09bc815..82d13fe6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2581,6 +2581,7 @@ tests/FunctionalTests/tickets/protected/pages/Ticket605.page -text tests/FunctionalTests/tickets/protected/pages/Ticket606.page -text tests/FunctionalTests/tickets/protected/pages/Ticket609.page -text tests/FunctionalTests/tickets/protected/pages/Ticket614.page -text +tests/FunctionalTests/tickets/protected/pages/Ticket617.page -text tests/FunctionalTests/tickets/protected/pages/Ticket68.page -text tests/FunctionalTests/tickets/protected/pages/Ticket72.page -text tests/FunctionalTests/tickets/protected/pages/Ticket72.php -text diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php index a66ab21c..b6b19d13 100644 --- a/framework/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Data/ActiveRecord/TActiveRecord.php @@ -625,4 +625,4 @@ abstract class TActiveRecord extends TComponent $this->raiseEvent('OnExecuteCommand', $this, $param); } } -?> +?> \ No newline at end of file diff --git a/framework/Web/Javascripts/source/prado/validator/validation3.js b/framework/Web/Javascripts/source/prado/validator/validation3.js index 28028d6d..b7793d49 100644 --- a/framework/Web/Javascripts/source/prado/validator/validation3.js +++ b/framework/Web/Javascripts/source/prado/validator/validation3.js @@ -215,11 +215,23 @@ Prado.ValidationManager.prototype = { var partition = this.validatorPartition(group); var valid = partition[0].invoke('validate', source).all(); + this.focusOnError(partition[0]); partition[1].invoke('hide'); this.updateSummary(group, true); return valid; }, + /** + * Focus on the first validator that is invalid and options.FocusOnError is true. + */ + focusOnError : function(validators) + { + for(var i = 0; i < validators.length; i++) + { + if(!validators[i].isValid && validators[i].options.FocusOnError) + return Prado.Element.focus(validators[i].options.FocusElementID); + } + }, /** * @return array[0] validators belong to a group if group is given, otherwise validators @@ -602,8 +614,8 @@ Prado.WebUI.TBaseValidator.prototype = { this.refreshControlAndMessage(); - if(this.options.FocusOnError && !this.isValid ) - Prado.Element.focus(this.options.FocusElementID); + //if(this.options.FocusOnError && !this.isValid ) + // Prado.Element.focus(this.options.FocusElementID); this.visible = true; }, diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket617.page b/tests/FunctionalTests/tickets/protected/pages/Ticket617.page new file mode 100644 index 00000000..d63a84a7 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket617.page @@ -0,0 +1,77 @@ + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+ + +
\ No newline at end of file -- cgit v1.2.3