![]() |
| > Home > Documentation > Latest documentation > Interchange tags > error |
|
errorManage form variable error checking for the Interchange submit form processing action. Summary
ExamplesPerl example
or similarly with positional parameters:
DescriptionThe [error] tag is designed to manage form variable checking for the Interchange submit form processing action. It works in conjunction with the definition, set in mv_order_profile. and can generate error messages in any format you desire. If the variable in question passes its order profile checks then it will output a label. By default, bold text will be used if the item is required or normal text if not (as controlled by the require parameter). If the variable fails one or more of its order checks then the error message will be substituted into a template and the error cleared from the user's session. You can use the following to show a list of errors, without clearing the list at the same time:
You can also use the [if errors] test to check for individual form field errors:
ParametersnameThe name of the form variable. allall=1 means display all error messages, not just the one referred to by name. The default is only display the error message assigned to name. autoSetting this parameter true will cause the following parameters to be set, as follows:
classCSS class name used only if auto is true. extraExtra list_container HTML tag parameters, only used if auto is true. filterSetting filter="filter1 filter2" modifies the returned error message(s) by running the text through the specified filter(s). See the filters category for a list of standard filters. footerFooter value used at the end of the output if all is true. headerHeader value used at the start of the output if all is true. joinerCharacter used to join multiple error messages. The default is "<li>" if auto is true, otherwise the default is "\n" (a newline). keepIf set true then this tag will not delete the error message(s) after use. list_containerDefault list container HTML tag, used if auto is true. overwriteOverwrite any existing error messages, with the value specified using the set parameter, instead of appending the new message. requiredSpecifies that this is a required field for, formatting purposes. In the std_label format, it means the field will be emboldened. If you specify your own label string, it will insert HTML anywhere you have {REQUIRED: HTML}, but only when the field is required. setThis is used to raise an error against a named form variable. This could be useful in a custom, non-profile-based, form checking routine.
The message will be appended to any existing messages (using "AND" as the message separator) unless the overwrite parameter is set true. show_errorshow_error=1 means return the error message text, otherwise just the number of errors found is returned. show_labelshow_label=1 causes the field label, set by a previous [error] tag's std_label attribute, to be included as part of the error message, like this:
If no std_label was set, the variable name will be used instead. This can also be used in combination with show_var to show both the label and the variable name. show_varshow_var=1 includes the name of the variable, in which the error was found, as part of the error message, like this:
std_labelIf supplied, this parameter's value will be stored in the user's session for possible use in a subsequent call to [error show_label=1]. A return value will be built in the following manner:
styleCSS style value(s) used only if auto is true. textOptional string in which to embed the returned error message(s). See the "std_label" parameter.
|
| Home | Legal nonsense | Privacy policy | Contact us |