From fceb3741d3b0c1e00e81a4a24caf7d49a86896b4 Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 22 Feb 2006 02:46:25 +0000 Subject: Updated some validators and relevant demos. --- .../Samples/TEmailAddressValidator/Home.page | 3 +- .../Samples/TRegularExpressionValidator/Home.page | 21 +++--- .../Samples/TRequiredFieldValidator/Home.page | 74 +++++++++++++++++++++- .../protected/pages/Controls/Validation.page | 39 ++++++++---- 4 files changed, 111 insertions(+), 26 deletions(-) (limited to 'demos') diff --git a/demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.page index db63a0a9..79066e44 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.page @@ -1,7 +1,7 @@

TEmailAddressValidator Samples

-

Note:TEmailAddressValidator will start +

Note: TEmailAddressValidator will start to validate only if the input is not empty.

@@ -44,6 +44,7 @@ Email address validator with focus-on-error enabled and dynamic display: diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.page index 5ce43fda..9c27057b 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.page @@ -1,8 +1,11 @@

TRegularExpressionValidator Samples

-

Note:TRegularExpressionValidator will start -to validate only if the input is not empty.

+

+Note: TRegularExpressionValidator will start +to validate only if the input is not empty. +

+
@@ -10,12 +13,12 @@ to validate only if the input is not empty.

Regular expression validator with default settings: @@ -30,8 +33,8 @@ Regular expression validator with client-side validation disabled: ValidationGroup="Group2" EnableClientScript="false" ControlToValidate="TextBox2" - RegularExpression="\d+" - Text="Only digits are allowed." /> + RegularExpression="[\w]{6,}" + Text="Input must consist of at least 6 characters." /> @@ -46,8 +49,8 @@ Regular expression validator with focus-on-error enabled and dynamic display: ValidationGroup="Group3" ControlToValidate="TextBox3" Display="Dynamic" - RegularExpression="\d+" - Text="Only digits are allowed." /> + RegularExpression="\d{5}(-\d{4})?" + Text="Invalid US ZIP code." /> diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRequiredFieldValidator/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TRequiredFieldValidator/Home.page index 36d02ced..e5c27cd0 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TRequiredFieldValidator/Home.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TRequiredFieldValidator/Home.page @@ -6,7 +6,7 @@ + + + + + + + + + + + + + + + + + + +
- + + RegularExpression="\d{3}-\d{2}-\d{4}" + Text="SSN must be in the format of xxx-xx-xxxx." />
-Required field validator with default settings: +Validator with default settings: @@ -20,7 +20,7 @@ Required field validator with default settings:
-Required field validator with client-side validation disabled: +Validator with client-side validation disabled: @@ -35,12 +35,13 @@ Required field validator with client-side validation disabled:
-Required field validator with focus-on-error enabled and dynamic display: +Validator with focus-on-error enabled and dynamic display: @@ -48,6 +49,73 @@ Required field validator with focus-on-error enabled and dynamic display:
+Validating if initial value (test) is changed: + + + + +
+Validating if checkbox is checked: + + + + +
+Validating if a selection has been made in a dropdown list: + + + + + + + + +
+Validating if a selection has been made in a dropdown list: + + + + + + + + +
diff --git a/demos/quickstart/protected/pages/Controls/Validation.page b/demos/quickstart/protected/pages/Controls/Validation.page index 74925447..fe801183 100644 --- a/demos/quickstart/protected/pages/Controls/Validation.page +++ b/demos/quickstart/protected/pages/Controls/Validation.page @@ -12,7 +12,7 @@ In addition, if EnableClientScript is true, validation will also be per
ControlToValidate
The ID of the component for this validator. This property must be set to the ID path of an input component. The ID path is the dot-connected IDs of the components reaching from the validator's parent component to the target component.
- +
ErrorMessage
The text for the error message when the input component failed to validate.
@@ -21,14 +21,14 @@ In addition, if EnableClientScript is true, validation will also be per
Display
-
The display behavior of the error message in a validation component. The allowed values are: None, Static and Dynamic. The default is Static. +
The display behavior of the error message in a validation component. The allowed values are: None, Static and Dynamic. The default is Static.
  • None -- the validator component and the error message will not be displayed.
  • Dynamic -- CSS for the error is constructed in such a way that space for the error message on the page is NOT reserved. When the user hits the "submit" button, applicable error messages will show up shifting the layout of your page around (usually down).
  • Static -- CSS for the error is constructed in such a way that space for the error message on the page is always reserved. When the user hits the "submit" button, applicable error messages will just show up, not altering the layout of your page.
- +
EnableClientScript
Indicating whether client-side validation is enabled. Default is true.
@@ -53,7 +53,6 @@ This is the simplest validator, ensuring that the input field has some sort of v
The regular expression that determines the pattern used to validate a field. Some commonly used regular expressions include: - More regular expression patterns can be found on the Internet, e.g. + More regular expression patterns can be found on the Internet, e.g. http://regexlib.com/.
+

+Note, if the value being validated is empty, TRegularExpressionValidator will not do validation. Use a TRequiredFieldValidator to ensure the value is not empty. +

TEmailAddressValidator

-

TEmailAddressValidator validates whether the value of an associated input component is a valid email address. It will check MX record if checkdnsrr() is available in the installed PHP. +

TEmailAddressValidator validates whether the value of an associated input component is a valid email address. If CheckMXRecord is true, besides checking the format of the input value, the validator will also check MX record for the email address, provided checkdnsrr() is available in the installed PHP. +

+

+Note, if the value being validated is empty, TEmailAddressValidator will not do validation. Use a TRequiredFieldValidator to ensure the value is not empty.

@@ -81,10 +86,10 @@ This is the simplest validator, ensuring that the input field has some sort of v
ControlToCompare
The input component to compare with the input control being validated.
- +
ValueToCompare
A constant value to compare with the value entered by the user into the input component being validated.
- +
ValueType
The data type (Integer, Double, Currency, Date, String) that the values being compared are converted to before the comparison is made.
@@ -104,12 +109,12 @@ This is the simplest validator, ensuring that the input field has some sort of v
Integer
A 32-bit signed integer data type.
-
Double
+
Float
A double-precision floating point number data type.
- +
Currency
A decimal data type that can contain currency symbols.
- +
Date
A date data type, the date format depends on the DateFormat property.
@@ -120,16 +125,24 @@ This is the simplest validator, ensuring that the input field has some sort of v

Use the Operator property to specify the type of comparison to perform. If you set the Operator property to DataTypeCheck, the TCompareValidator component will ignore the ControlToCompare and ValueToCompare properties and simply indicates whether the value entered into the input component can be converted to the data type specified by the ValueType property.

Note that if the input control is empty, no validation functions are called and validation succeeds. Use a RequiredFieldValidator control to require the user to enter data into the input control.

+ +

TRangeValidator

+

+

+ - - +

TValueTypeValidator

+

+

+

TCustomValidator

+

TValidationSummary

-- cgit v1.2.3