summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwei <>2006-07-02 05:50:29 +0000
committerwei <>2006-07-02 05:50:29 +0000
commit875efd1707a2ac5307b24181ddd7e0420bff5854 (patch)
treea7e3fa5da5aad29cba83f56b47a92d6126ef88f7
parent4009bc98e96c38d22b3c199f3bfefe4c30783d00 (diff)
fixed 3.02 bug
-rw-r--r--HISTORY6
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php18
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket205.page24
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket205.php11
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket207.page16
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket205TestCase.php23
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket207TestCase.php37
7 files changed, 126 insertions, 9 deletions
diff --git a/HISTORY b/HISTORY
index b0d5a6cb..0af0a060 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2,14 +2,15 @@ Version 3.0.2 July 2, 2006
==========================
BUG: Ticket#182 - List and validator controls cause problem in child classes (Qiang)
BUG: Ticket#191 - Duplicated postbacks occur when using TButton with validators (Qiang)
+BUG: Ticket#207 - Validators ClientSide.OnError triggered twice (Wei)
BUG: Ticket#213 - PRADO Requirements Checker charset error (Qiang)
+BUG: Ticket#227 - Enabled property doesn't works with THtmlArea (Wei)
BUG: Ticket#234 - Postback target could be out of date (Qiang)
BUG: Ticket#239 - Ondeactivate handler for the first View of MultiView is always fired (Qiang)
BUG: Ticket#244 - redirect() needs absolute URL (Qiang)
BUG: Ticket#245 - getIsSecureConnection() is not working correctly (Qiang)
-BUG: Ticket#260 - Wrong value of a configuration option in setUseTransparentSessionID (Qiang)
-BUG: Ticket#227 - Enabled property doesn't works with THtmlArea (Wei)
BUG: Ticket#246 - TDatePicker wrong popup position in scrolled div (Wei)
+BUG: Ticket#260 - Wrong value of a configuration option in setUseTransparentSessionID (Qiang)
CHG: ensureChildControls() is now invoked in TControl::initRecursive (Qiang)
CHG: Postback enabled control will always disable default client-side browser action. (Qiang)
CHG: CSS and JS files in a theme are now included in page in alphabetic order (Qiang)
@@ -24,6 +25,7 @@ ENH: TRepeater, TDataList and TDataGrid will store data indices in DataKeys if D
ENH: Added TPageService.BasePageClass property (Qiang)
ENH: Added TDataGrid.EmptyTemplate property (Qiang)
ENH: Added paging feature to all TDataBoundControl-derived controls (Qiang)
+ENH: ClientSide.ObserveChanges="false" to only revalidate client side validator when control changes (Wei)
NEW: Added TPager (Qiang)
NEW: Added Dreamweaver taglib extension (Stanislav, Qiang)
NEW: Prado Command line script to create a new project, see framework/prado-cli.php (Wei)
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index 3b2f0ec6..5917f313 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -647,12 +647,30 @@ class TValidatorClientScript extends TComponent
}
/**
+ * @param boolean true to revalidate when the control to validate changes value.
+ */
+ public function setObserveChanges($value)
+ {
+ $this->_options->add('ObserveChanges', TPropertyValue::ensureBoolean($value));
+ }
+
+ /**
+ * @return boolean true to observe changes.
+ */
+ public function getObserveChanges()
+ {
+ $changes = $this->_options->itemAt('ObserveChanges');
+ return is_null($changes) ? true : $changes;
+ }
+
+ /**
* @return array list of client-side event code.
*/
public function getOptions()
{
return $this->_options->toArray();
}
+
/**
* Ensure the string is a valid javascript function. If the string begins
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket205.page b/tests/FunctionalTests/tickets/protected/pages/Ticket205.page
index 1f271c14..1481a227 100644
--- a/tests/FunctionalTests/tickets/protected/pages/Ticket205.page
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket205.page
@@ -1,4 +1,26 @@
<com:TContent ID="Content">
<h3>TCustomValidator not enabling ControlCssClass or prop:ClientSide.OnError after postback.</h3>
-
+ <style>
+ .required
+ {
+ border: 1px solid red;
+ background-color: pink;
+ }
+ </style>
+ <script type="text/javascript">
+ function clientSideCustomValidate(sender, param)
+ {
+ return param == "Prado";
+ }
+ </script>
+ <com:TTextBox ID="textbox1" />
+ <com:TCustomValidator
+ ID="validator1"
+ ControlToValidate="textbox1"
+ ControlCssClass="required"
+ OnServerValidate="customValidate"
+ ClientValidationFunction="clientSideCustomValidate"
+ ClientSide.OnError="alert('error')"
+ ErrorMessage="must equal to 'Prado'" />
+ <com:TButton ID="button1" Text="Submit!" />
</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket205.php b/tests/FunctionalTests/tickets/protected/pages/Ticket205.php
new file mode 100644
index 00000000..6145af9a
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket205.php
@@ -0,0 +1,11 @@
+<?php
+
+class Ticket205 extends TPage
+{
+ function customValidate($sender, $param)
+ {
+ $param->IsValid = $this->textbox1->Text == "Prado";
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket207.page b/tests/FunctionalTests/tickets/protected/pages/Ticket207.page
index 8826c208..556c5aae 100644
--- a/tests/FunctionalTests/tickets/protected/pages/Ticket207.page
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket207.page
@@ -1,13 +1,17 @@
<com:TContent ID="Content">
<h2>Validators ClientSide.OnError triggered twice</h2>
- <com:TTextBox ID="T" /><br />
- <com:TRequiredFieldValidator ControlToValidate="T" Text="Error"
- ClientSide.OnError="Logger.info('error on T fired')" />
+ <h3>Use ClientSide.ObseveChanges="false"</h3>
+ <com:TTextBox ID="text1" /><br />
+ <com:TRequiredFieldValidator
+ id="validator1"
+ ControlToValidate="text1" Text="Error"
+ ClientSide.ObserveChanges="false"
+ ClientSide.OnError="alert('error on text1 fired')" />
<br />
- <com:TTextBox ID="B" /><br />
- <com:TRequiredFieldValidator ControlToValidate="B" Text="Error" />
+ <com:TTextBox ID="text2" /><br />
+ <com:TRequiredFieldValidator id="validator2" ControlToValidate="text2" Text="Error" />
<br />
- <com:TButton Text="submit" />
+ <com:TButton id="button1" Text="submit" />
<h3>Conditions</h3>
<pre>
(TextBox? B is just there to prevent server submission)
diff --git a/tests/FunctionalTests/tickets/tests/Ticket205TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket205TestCase.php
new file mode 100644
index 00000000..85785697
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket205TestCase.php
@@ -0,0 +1,23 @@
+<?php
+
+class Ticket205TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $base = 'ctl0_Content_';
+ $this->open("tickets/index.php?page=Ticket205");
+ $this->assertTitle("Verifying Ticket 205");
+ $this->assertNotVisible("{$base}validator1");
+
+ $this->type("{$base}textbox1", "test");
+ $this->click("{$base}button1");
+ $this->assertVisible("{$base}validator1");
+ $this->assertAlert("error");
+
+ $this->type("{$base}textbox1", "Prado");
+ $this->clickAndWait("{$base}button1");
+ $this->assertNotVisible("{$base}validator1");
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Ticket207TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket207TestCase.php
new file mode 100644
index 00000000..53ae6528
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket207TestCase.php
@@ -0,0 +1,37 @@
+<?php
+
+class Ticket207TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $base = 'ctl0_Content_';
+ $this->open('tickets/index.php?page=Ticket207');
+ $this->assertTitle("Verifying Ticket 207");
+ $this->assertNotVisible("{$base}validator1");
+ $this->assertNotVisible("{$base}validator2");
+
+ $this->click("{$base}button1");
+ $this->assertAlert('error on text1 fired');
+ $this->assertVisible("{$base}validator1");
+ $this->assertVisible("{$base}validator2");
+
+ $this->type("{$base}text1", 'test');
+ $this->assertVisible("{$base}validator1");
+ $this->assertVisible("{$base}validator2");
+
+ $this->click("{$base}button1");
+ $this->assertNotVisible("{$base}validator1");
+ $this->assertVisible("{$base}validator2");
+
+ $this->type("{$base}text1", '');
+ $this->assertNotVisible("{$base}validator1");
+ $this->assertVisible("{$base}validator2");
+
+ $this->click("{$base}button1");
+ $this->assertAlert('error on text1 fired');
+ $this->assertVisible("{$base}validator1");
+ $this->assertVisible("{$base}validator2");
+ }
+}
+
+?> \ No newline at end of file