Professional Documents
Culture Documents
This page will provide sample validations using LCV, the Lightweight Client-side Validation pattern. Seethe main LCV page for the LCV code and instructions on how to implement it. LCV validates any control that has an lcv, lcv_custom, or lcv_table classname. If it finds that "toplevel" classname, then it looks at the other pre-defined lcv classnames and responds accordingly. If a control has one of the "required" validators, and that validator fails, then none of the other validators for that ccontrol is tested. The samples below can serve as a reference list, of sorts, to the most common validation needs.
lcv lcv_input_required lcv_label_First_Name Error message: First Name is required Notes: -Labels must contain underscores for spaces -If a valid lcv_label class is not found, the default word "Value" is used instead. This applies to all validators, except when a custom error message is created
Input is required with custom error message
lcv lcv_input_notEqualToVar lcv_input_notEqualToVar_var_DepartureCity Error: Value must not be New York City (assuming DepartureCity's current value is "New York City")
Page 1
lcv lcv_input_lessThanEqualToControl lcv_input_lessThanEqualToControl_id_InputText2 Error: Value must be less than or equal to 48 (assuming InputText2's current value is 48)
Input is required when a particular radio button is selected
lcv lcv_input_radioRequiredWhenRadioEqualVal lcv_input_radioRequiredWhenRadioEqualVal_val_Yes lcv_input_radioRequiredWhenRadioEqualVal_name_tw#local#likesIceCream Error: Value is required. (It is suggested you include a custom error message for this validator.)
Input with multiple custom error messages
lcv lcv_input_required lcv_input_required_errorMessage_Birth_year_is_required lcv_input_isNumeric lcv_input_greaterThanVal lcv_input_greaterThanEqualToVal_val_1900 lcv_errorMessage_Birth_year_must_be_a_four_digit_year_after_1900 Error (if empty): Birth year is required Error (if non-numeric): Birth year must be a four digit year after 1900 Error (if earlier than 1900): Birth year must be a four digit year after 1900 Note: the "lcv_errorMessage" (if provided) is the "catch-all" error that will be applied to both the isNumeric and greaterThanValEqualTo validators since they do not have rule-specific error messages.
Input with default error message based on label
lcv lcv_input_required lcv_input_isNumeric lcv_label_Birth_year Error message (if empty): Birth year is required Error message (if non-numeirc): Birth year must be numeric
Page 2