<NOT_NULL/> Zero test in dynamic forms
Input components may contain a value or may be “empty”. If no value is stored in the input component, this can return either an:
- empty value (for example, CMS_INPUT_TEXT) or
- NULL (for example, CMS_INPUT_NUMBER), depending on the type of component.
The <NOT_NULL/> tag can be set in the value determination area of the rule definition (or for the definition of a precondition) and checks whether an input component contains a value (TRUE) or returns NULL (FALSE). The check always refers to the value of an input component. To this end, it is also necessary to add a <PROPERTY/> tag (with the value attribute) inside the <NOT_NULL/> tag.
For input components that contain an empty value, which is the case for the FirstSpirit text input components, for instance, the <NOT_NULL/> check also returns TRUE. To prevent storing the empty values, the <PROPERTY/> tag can be used in conjunction with the empty attribute for the check instead of <NOT_NULL/>. |
Special conditions also apply to input components for which a default value has been added within the form template (more on this subject). |
Example
As long as the editor has not selected anything in the combo box, the FirstSpirit framework highlights the input component in the workspace in color (see Display in the working area) and displays a note.
The surrounding <ON_SAVE/> tags also prevent saving of the form.
<RULES>
<ON_SAVE>
<WITH>
<NOT_NULL>
<PROPERTY source="st_combobox" name="VALUE"/>
</NOT_NULL>
</WITH>
<DO>
<VALIDATION>
<PROPERTY source="st_combobox" name="VALID"/>
<MESSAGE lang="*" text=""Not Null" comparison"/>
<MESSAGE lang="DE" text=""Not Null"-Prüfung"/>
</VALIDATION>
</DO>
</ON_SAVE>
</RULES>