Documentation Archive Developer
Search
[an error occurred while processing this directive] PATH  Documentation > WebObjects 4.5 > Dynamic Elements

up

WOConditional



Element Description

A WOConditional object controls whether a portion of the HTML page will be generated, based on the evaluation of its assigned condition.


Synopsis

WOConditional { condition=aBoolean; [negate=aBoolean;] ... };


Bindings

condition
If condition evaluates to YES or true, and assuming that negate isn't in effect, the HTML code controlled by the WOConditional object is emitted; otherwise it is not.
negate
Inverts the sense of the condition. By default, negate is assumed to be false or NO.

Example

The negate attribute lets you use the same test to display mutually exclusive information; for example:


HTML file:

<HTML>
<WEBOBJECTS NAME="PAYING_CUSTOMER">Thank you for your order!</WEBOBJECTS>
<WEBOBJECTS NAME="WINDOW_SHOPPER">Thanks for visiting!</WEBOBJECTS>
</HTML>


Declarations File:

PAYING_CUSTOMER: WOConditional {condition=payingCustomer;};
WINDOW_SHOPPER: WOConditional {condition=payingCustomer; negate=YES;};


Script File:

- payingCustomer {
    if (/* ordered something */) {
        return YES;
    }
    return NO;
}


up