Webform verification control and webform Control

Source: Internet
Author: User

Webform verification control and webform Control

 

 

Verification:
1. Non-empty verification RequiredFieldValidator
ErrorMessage-message displayed after an error is verified
ControlToValidate-ID of the control to be verified
Display-Display mode. Static-space occupied when not displayed. Dynamic-no space displayed
InitialValue-the initial value for verification. If the value of the verified control is the same as this value, it is considered as null.

Scenario:
(1) Not filled
(2) The initial value has not changed: it is implemented by setting InitialValue.

Ii. Comparison and Verification
ErrorMessage-message displayed after an error is verified
ControlToValidate-ID of the control to be verified
Display-Display mode. Static-space occupied when not displayed. Dynamic-no space displayed
ControlToCompare-the ID of the control to be compared
ValueToCompare-value to be compared
Operator-comparison Operator
Type-input comparison Type

Scenario:
1. Compare the values of the two controls.
2. Compare the input and fixed values of the control.

Iii. Range verification RangeValidator
ErrorMessage-message displayed after an error is verified
ControlToValidate-ID of the control to be verified
Display-Display mode. Static-space occupied when not displayed. Dynamic-no space displayed
MaximumValue-Maximum range
MinimumValue-lower limit of the range
Type-Type

4. Regular Expression verification RegularExpressionValidator
ErrorMessage-message displayed after an error is verified
ControlToValidate-ID of the control to be verified
Display-Display mode. Static-space occupied when not displayed. Dynamic-no space displayed
ValidationExpression-verification expression

5. Verification summary ValidationSummary
ShowMessageBox-whether to display summary error messages in the form of a dialog box
ShowSummary-whether to display summary error messages on the page

Vi. Custom Verification
ErrorMessage-message displayed after an error is verified
ControlToValidate-ID of the control to be verified
Display-Display mode. Static-space occupied when not displayed. Dynamic-no space displayed
ClientValidationFunction-name of the function verified by the client. (Do not add parentheses)

Specifications for client-side function verification:
Function Name (event source, event data)
{
Event Data. Value -- the Value to be verified. The value in the input box to be verified by the verification control.
Event Data. IsValid -- tells the verification control to verify whether it passes.
}

Function zhiShu (a, B) {// a-event source, B-Event Data
// Step
// 1. Obtain the value to be verified.
Var s = B. Value;
// 2. Verify
Var isOK = false;
If (isNaN (s) = false) {// you must first check whether it is a number.
Var zc = 0;
Var num = parseInt (s );
For (var I = 1; I <= num; I ++) {// records zc ++ from 1 to the value itself;
If (num % I = 0 ){
Zc ++;
}
}
If (zc = 2 ){
IsOK = true;
}
Else {
IsOK = false;
}
}
Else {
IsOK = false;
}

// 3. tell whether the verification control has passed the verification.
B. IsValid = isOK;
}


Two tips:
1. Prevent buttons from initiating verification controls.
By default, the three buttons will trigger verification.
If you do not want to trigger the verification: Give the button CauseValidation = false

2. Verify the group.
Set the ValidationGroup attributes of the input controls (text box, single-choice, multiple-choice), verification controls (non-empty, comparison, range, regular expression, custom, and summary), and buttons to the same values. They become a group.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.