summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/Javascripts/source/prado/validator/validation3.js11
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php11
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket595.page6
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket595TestCase.php4
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,10 +243,19 @@ 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.
* @return boolean true if change, false otherwise.
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 @@
<com:TContent ID="Content">
-
+<style type="text/css">
+ .errorclassA, .errorclassB {
+ background-color:pink;
+ }
+</style>
<com:TTextBox ID="A" />
<com:TRequiredFieldValidator ControlToValidate="A" Text="Required!" ControlCssClass="errorclassA" ValidationGroup="A"/>
<com:TEmailAddressValidator ControlToValidate="A" Text="No Email!" ControlCssClass="errorclassA" ValidationGroup="A"/>
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','');