Conditional Logic Object

Conditional Logic Object

IntroductionUsagePropertiesRule Properties

Introduction

Conditional Logic, when applied to the form or page button or to any field, controls the visibility of that element based on a choice selected or value entered by the user in other fields on the form. It can also be used to determine if a notification, confirmation or add-on feed should be used.

12345678910111213array(    'conditionalLogic' => array(        'actionType' => 'show',        'logicType'  => 'all',        'rules'      => array(            array(                'fieldId'  => 2,                'operator' => 'is',                'value'    => 'Second Choice',            ),        )    ),);

Usage

12345678// returns the conditional logic rules for the form button$rules = rgars( $form, 'button/conditionalLogic/rules' ); // returns the conditional logic rules for the field$rules = rgar( $field->conditionalLogic, 'rules' ); // returns the conditional logic rules for the feed$rules = rgars( $feed, 'meta/feed_condition_conditional_logic_object/conditionalLogic/rules' );

Properties

actionType stringThe type of action the conditional logic will perform. Possible values: show, hide

show: Displays the field when the rules match and hides the field when the rules do not match
hide: Hides the field when the rules match and displays the field when the rules match

logicType stringDetermines how to the rules should be evaluated. Possible values: any, all

any: Evaluates the conditional logic to true if any of the rules match. More specifically, will OR the rules together (i.e. rule1 || rule2 || rule3)
all: Evaluates the conditional logic to true if all rules match. More specifically, will AND the rules together (i.e. rule1 && rule2 && rule3)

rules arrayAn associative array containing the conditional logic rules. See below for the individual rule properties.

Rule Properties

fieldId integer
Target field Id. Field that will have it』s value compared with the value property to determine if this rule is a match

operator string
Operator to be used when evaluating this rule. Possible values: is, isnot, >, <, contains, starts_with, or ends_with is: Evaluates this rule to true when the value property is equal to the value of field specified by fieldId. isnot: Evaluates this rule to true when the value property is not equal to the value of field specified by fieldId. value stringThe value to compare with field specified by fieldId

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注