From d5950ec0b553d46c4800adc0532d4464a4eb1883 Mon Sep 17 00:00:00 2001
From: wei <>
Date: Tue, 27 Mar 2007 08:34:28 +0000
Subject: Fixed #278, conditional validation.
---
.../Controls/Samples/ResetValidation/Home.page | 25 +++++++++
.../Controls/Samples/ResetValidation/Home.php | 8 +++
.../Samples/TClientSideValidator/Home.page | 63 ++++++++++------------
.../Controls/Samples/TClientSideValidator/Home.php | 18 +++----
.../protected/pages/Controls/Validation.page | 31 +++++++----
.../pages/GettingStarted/Introduction.page | 3 +-
6 files changed, 92 insertions(+), 56 deletions(-)
create mode 100644 demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.page
create mode 100644 demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php
(limited to 'demos/quickstart/protected')
diff --git a/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.page b/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.page
new file mode 100644
index 00000000..44f84abe
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.page
@@ -0,0 +1,25 @@
+
+
+Reset Validation using Javascript
+
+
+
+$Id: Home.page 1650 2007-01-24 06:55:32Z wei $
\ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php b/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php
new file mode 100644
index 00000000..88d2dbf2
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.page
index c70e04c7..76ecb845 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.page
@@ -1,41 +1,36 @@
- Validator Toggle - Server and Client Side
-
-
-
-
-
-
+Conditional Validation (client-side + server side)
-
-
+
+
+
+Validator with default settings:
+Check "optional" to validate both textboxes
+ |
+
+
+
+
+
+ sender.enabled = $('<%= $this->check1->ClientID %>').checked;
+
-
-
- sender.enabled = $("<%= $this->check1->ClientID %>").checked;
-
-
+
+
+
+ |
+
-
+
-
-
-
- Event.OnLoad(function()
- {
- Event.observe("<%= $this->check1->ClientID %>", "click", function(ev)
- {
- $("<%= $this->panel1->ClientID %>").toggle();
- });
- });
-
$Id$
\ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php
index c5440996..d6dded08 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php
@@ -2,22 +2,16 @@
class Home extends TPage
{
- function validator2_onValidate($sender, $param)
+ function check_validate($sender, $params)
{
- $sender->Enabled = $this->check1->Checked;
+ $sender->enabled = $this->check1->checked;
}
-
- function validate2_onPostValidate($sender, $param)
- {
- $sender->Enabled = true;
- }
-
+
function onPreRender($param)
{
- parent::onPreRender($param);
- $this->panel1->Style =
- $this->check1->Checked ? "display:block" : "display:none";
- }
+ //always re-enable the validator2 so as to display the client-side validator
+ $this->validator2->enabled=true;
+ }
}
?>
\ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Validation.page b/demos/quickstart/protected/pages/Controls/Validation.page
index 38699550..b93f6d49 100644
--- a/demos/quickstart/protected/pages/Controls/Validation.page
+++ b/demos/quickstart/protected/pages/Controls/Validation.page
@@ -31,14 +31,7 @@ Validators share a common set of properties, which are defined in the base class
FocusElementID - the ID of the HTML element that will receive focus if validation fails and FocusOnError is true.
-Interacting the Validators with Javascript
-Resetting or Clearing of Validators
-
-Validators can be reset on the client-side using javascript by calling the
-Prado.Validation.reset(groupID) where groupID is the validator
-grouping name. If groupID is null, then validators without grouping are used.
-
-
+Prado Validation Controls
TRequiredFieldValidator
@@ -159,6 +152,24 @@ The summary can be displayed as a list, a bulleted list, or a single paragraph b
+Interacting the Validators
+Resetting or Clearing of Validators
+
+Validators can be reset on the client-side using javascript by calling the
+Prado.Validation.reset(groupID) where groupID is the validator
+grouping name. If groupID is null, then validators without grouping are used.
+
+
+
+
+
+
+
Client and Server Side Conditional Validation
All validators contains the following events.
@@ -191,7 +202,9 @@ is the control that invoked the validator.
Conditional Validation Example
The following example show the use of client-side and server side validator events. The example
-demonstrates conditional validation.
+demonstrates conditional validation. Notice that, we need to write code for both the
+server side and client-side. Moreover, on the server side, we need to re-enable the conditional
+validator so that its javascript code are produced no matter what (otherwise, the client-side validator is not available).
diff --git a/demos/quickstart/protected/pages/GettingStarted/Introduction.page b/demos/quickstart/protected/pages/GettingStarted/Introduction.page
index e48360d6..f267d23d 100644
--- a/demos/quickstart/protected/pages/GettingStarted/Introduction.page
+++ b/demos/quickstart/protected/pages/GettingStarted/Introduction.page
@@ -7,6 +7,7 @@ This Quickstart tutorial is provided to help you quickly start building your own
If you are an existing PRADO 3.x user and would like to learn what enhancements are available for each new version, please check out the new features page. Otherwise, the following sections are helpful for newbies.
+
You may refer to the following resources if you find this tutorial does not fulfill all your needs.
--
cgit v1.2.3