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.