From 24f10e736df7705dbbff76d2f3345eaba369f432 Mon Sep 17 00:00:00 2001 From: tof <> Date: Tue, 8 Apr 2008 14:48:48 +0000 Subject: Fixed #595 --- HISTORY | 1 + .../Web/Javascripts/source/prado/validator/validation3.js | 11 ++++++++++- framework/Web/UI/WebControls/TBaseValidator.php | 11 ++++++++++- tests/FunctionalTests/tickets/protected/pages/Ticket595.page | 6 +++++- tests/FunctionalTests/tickets/tests/Ticket595TestCase.php | 4 ++-- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/HISTORY b/HISTORY index f1958572..ab69a842 100644 --- a/HISTORY +++ b/HISTORY @@ -1,5 +1,6 @@ Version 3.1.2 To be released ============================ +BUG: Ticket#595 - ControlCssClass not applied correctly if using multiple validators on same control (Christophe) BUG: Ticket#636 - I18N catalogue problem (Christophe) BUG: Ticket#669 - Strange rendering behaviour with TActivePanel (Christophe) BUG: Ticket#671 - TActiveCustomValidator Callback Problem (Christophe) diff --git a/framework/Web/Javascripts/source/prado/validator/validation3.js b/framework/Web/Javascripts/source/prado/validator/validation3.js index 47c031c4..290b6f62 100644 --- a/framework/Web/Javascripts/source/prado/validator/validation3.js +++ b/framework/Web/Javascripts/source/prado/validator/validation3.js @@ -667,9 +667,18 @@ Prado.WebUI.TBaseValidator.prototype = if(typeof(CssClass) == "string" && CssClass.length > 0) { if(valid) - control.removeClassName(CssClass); + { + if (control.lastValidator == this.options.ID) + { + control.lastValidator = null; + control.removeClassName(CssClass); + } + } else + { + control.lastValidator = this.options.ID; control.addClassName(CssClass); + } } }, diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index 96aefe63..59b4fc16 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -243,9 +243,18 @@ abstract class TBaseValidator extends TLabel implements IValidator } if($this->getEnableClientScript() & $this->getEnabled(true)) $this->registerClientScriptValidator(); - $this->updateControlCssClass(); } + /** + * Override parent implementation to update the control CSS Class before + * the validated control is rendered + */ + public function onPreRender ($param) + { + parent::onPreRender($param); + $this->updateControlCssClass(); + } + /** * Update the ControlToValidate component's css class depending * if the ControlCssClass property is set, and whether this is valid. diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket595.page b/tests/FunctionalTests/tickets/protected/pages/Ticket595.page index 11a926fa..33c45c8e 100644 --- a/tests/FunctionalTests/tickets/protected/pages/Ticket595.page +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket595.page @@ -1,5 +1,9 @@ - + diff --git a/tests/FunctionalTests/tickets/tests/Ticket595TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket595TestCase.php index df462c8d..e2487f25 100644 --- a/tests/FunctionalTests/tickets/tests/Ticket595TestCase.php +++ b/tests/FunctionalTests/tickets/tests/Ticket595TestCase.php @@ -15,7 +15,7 @@ class Ticket595TestCase extends SeleniumTestCase $this->click($base.'ctl2'); $this->assertAttribute($base.'A@class','errorclassA'); - $this->type($base.'A', 'test@example.com'); + $this->type($base.'A', 'test@pradosoft.com'); $this->click($base.'ctl2'); $this->pause(800); $this->assertAttribute($base.'A@class',''); @@ -30,7 +30,7 @@ class Ticket595TestCase extends SeleniumTestCase $this->pause(800); $this->assertAttribute($base.'B@class','errorclassB'); - $this->type($base.'B', 'test@example.com'); + $this->type($base.'B', 'test@pradosoft.com'); $this->click($base.'ctl5'); $this->pause(800); $this->assertAttribute($base.'B@class',''); -- cgit v1.2.3