rule Element
Defines an action invoked after an event has occurred in the form.
Type
xsd:complexType
Child Elements
Element | Description |
---|---|
assignmentAction | Defines an action to set the value of a field. |
closeDocumentAction | Defines a form close action. |
dialogBoxExpressionAction | Defines an XPath expression to be displayed in a dialog box. |
dialogBoxMessageAction | Defines a literal message to be displayed in a dialog box. |
exitRuleSet | An element which, if present at the end of the rule, stops further rule processing of the entire ruleSet when the rule is executed. |
openNewDocumentAction | Defines a form create action. |
queryAction | Defines a data connection query action. |
submitAction | Defines a form submit action. |
switchViewAction | Defines a view switch action. |
Attributes
Attribute | Type | Required | Description | Possible Values |
---|---|---|---|---|
caption | xsd:string |
Yes | Contains the name of the rule as it appears in the user interface. | string |
condition | xsd:string |
No | Defines the XPath expression, evaluated as a Boolean value, that determines whether the associated action will be invoked. | string |
isEnabled | xdYesNo |
No | Specifies whether the rule is enabled for the form. The default value is "yes". |
|
Definition
<xsd:element name="rule">
<xsd:complexType>
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="xsf:dialogBoxMessageAction"/>
<xsd:element ref="xsf:dialogBoxExpressionAction"/>
<xsd:element ref="xsf:switchViewAction"/>
<xsd:element ref="xsf:assignmentAction"/>
<xsd:element ref="xsf:queryAction"/>
<xsd:element name="submitAction">
<xsd:complexType>
<xsd:attribute name="adapter" type="xsf:xdTitle" use="required"></xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element ref="xsf:openNewDocumentAction"/>
<xsd:element ref="xsf:closeDocumentAction"/>
</xsd:choice>
<xsd:element name="exitRuleSet" minOccurs="0">
<xsd:complexType />
</xsd:element>
</xsd:sequence>
<xsd:attribute name="caption" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="condition" type="xsd:string" use="optional"></xsd:attribute>
<xsd:attribute name="isEnabled" type="xsf:xdYesNo" use="optional" default="yes"></xsd:attribute>
</xsd:complexType>
</xsd:element>
Remarks
Note This item is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Editions Service Pack 1 or later is not installed. Any form defined by a form definition file (.xsf) that includes this item cannot be opened in InfoPath when service pack features are disabled or unavailable.
Example
The following is an example of the rule element:
<xsf:ruleSets>
<xsf:ruleSet name="RuleSet1">
<xsf:rule caption="Receipts" condition="my:expense> 75">
<xsf:dialogBoxMessageAction>Don't forget receipts!</xsf:dialogBoxMessageAction>
<xsf:openNewDocumentAction solution="urn:approvalForm"/>
<xsf:exitRuleSet/>
</xsf:rule>
<xsf:rule caption="Always Submit" isEnabled="no">
<xsf:submitAction adapter="Expense Database"/>
</xsf:rule>
</xsf:ruleSet>
<xsf:ruleSet name="RuleSet2">
<xsf:rule caption="Look up contact">
<xsf:queryAction adapter="Contacts"/>
</xsf:rule>
</xsf:ruleSet>
</xsf:ruleSets>
Parent Objects | ruleSet Element
Child Objects | assignmentAction Element | closeDocumentAction Element | dialogBoxExpressionAction Element | dialogBoxMessageAction Element | exitRuleSet Element | openNewDocumentAction Element | queryAction Element | submitAction Element (rule Element) | switchViewAction Element