Index  Up  <<  >>  


error

CALL INFORMATION
Parameters: name

Positional parameters in same order.

The attribute hash reference is passed to the subroutine after the parameters as the last argument. This may mean that there are parameters not shown here.

Must pass named parameter interpolate=1 to cause interpolation.

Invalidates cache: no

Called Routine:

ASP/perl tag calls:

    $Tag->error(
        {
         name => VALUE,
        }
    )
  
 OR
 
    $Tag->error($name, $ATTRHASH);

 

DESCRIPTION
    [error var options]
        var is the error name, e.g. "session"

The [error ...] tag is designed to manage form variable checking for the Minivend 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 order profile checking, it will output a label, by default bold text if the item is required, or normal text if not (controlled by the <require> parameter. If the variable fails one or more order checks, the error message will be substituted into a template and the error cleared from the user's session.

(Below is as of 4.03, the equivalent in 4.02 is [if type=explicit compare=``[error all=1 keep=1]''] ... [/if].)

To check errors without clearing them, you can use the idiom:

    [if errors]
    <FONT SIZE="+1" COLOR=RED>
        There were errors in your form submission.
    </FONT>
    <BLOCKQUOTE>
        [error all=1 show_error=1 joiner="<BR>"]
    </BLOCKQUOTE>
    [/if]

The options are:

all=1
Display all error messages, not just the one refered to by <var>. The default is only display the error message assigned to <var>.

text=<optional string to embed the error message(s) in>

place a ``%s'' somewhere in 'text' to mark where you want the error message placed, otherwise it's appended on the end. This option also implies show_error.

joiner=<char>
Character used to join multiple error messages. Default is '\n', a newline.

keep=1
keep=1 means don't delete the error messages after copy; anything else deletes them.

show_var=1
show_var=1 means include the variable relating to the error message as part of the error message (E.g.: ``email: not a valid email address''.)

show_error=1 show_error=1 means return the error message text; otherwise just the number of errors found is returned.

std_label
std_label=<label string for error message>

used with 'required' to display a standardized error format. The HTML formating can bet set via the global variable MV_ERROR_STD_LABEL with the default being:

        <FONT COLOR=RED>label_str<SMALL><I>(%s)</I></SMALL></FONT>

where <label_str> is what you set std_label to and %s is substituted with the error message. This option can not be used with the text= option.

required=1
Specifies that this is a required field for formatting purposes. In the std_label format, it means the field will be bolded. If you specify your own label string, it will insert HTML anywhere you have {REQUIRED: HTML}, but only when the field is required.


Index  Up  <<  >>