Check.pm


NAME

Communiware::DE::Check - Dynamic element Check


SYNOPSIS

   <:Check action message condition [attr=value]:>


DESCRIPTION

Checks certain condition upon submit of posting form and perform desired action if it is fulfilled.

Action may be fail or warn

If action is fail posting wouldn't be performed, and ERROR context attribute would get value of message. If last argument of check has form ATTR=value, attribute with this name and this value would be added to the context besides ERROR attribute.

If action is warn posting would be performed and message would be appended to WARNING context attribute. attr=value argument is ignored if warn action is specified.

Condition is a logical expression as defined in Communiware::Expr documentation but may use both visualisation time and submit-time substitution.

In differnce of If dynamic element, no special treatment of first operand occurs.

If several Check dynamic elements are specified in the Post, following behavoir occurs:

  1. If at least one Check fail fails, posting aborted, and ERROR attribute contain all the error messags, joining using '\n' (use <PRE> tag to display it).

  2. If all fail checks succeed, but several warn ones failed, then WARINING attriute would contain all the warning messages joined via '\n'. This attribute would be preserved during redirect if one was specified in third argument of Post.

  3. If some Check has attr=value as last parameter, than attribute attr would be added to global context in case if check succeeds.

    If there are several Checks with same attr, their messages would be concatenated.

    This attribute would be passed accross redirect as well as WARNING attribute.

16 октябрь 2007 13:44