These rules are usually used with custom layouts, where you have your own layout defined for the form and want to show or hide blocks of fields conditionally
Consider a form that has few fields like this
// this rule will show the container by its "ID" when "showDetails" field is checked // this rule shows an extra field when you select an "other" option in the "options" dropdown field (and hides it otherwise) |
|
Implemented like
Using our Div container user macro | Using div macro from Content Formatting Macros for Confluence by Adaptavist |
---|---|
Please note that Div container user macro we have has certain limitations due to the way how user macros are rendered in Confluence. If you can use other macro that can be addressed via CSS then it is advisable to use that
As you can see, our form has 5 fields and 2 rules. Actually there are 4 rules, as each of the 2 rules has a "reverse rule" automatically created. That works for show/hide rules very well and you do not need to create an extra reverse rule yourself.
Our 5 fields are:
Now let's see the 2 rules that add the dynamics to our form:
Rule 1 | Rule 2 | |
---|---|---|
First rule is "bound" to field "showDetails" and tracks for changes It has a condition to check if showDetails field has value "true" and we use CSS3 selector, by element id (more on CSS https://developer.mozilla.org/en-US/docs/Web/CSS)
As this is the name "mycontainer" we set to our DIV macro's ID parameter | See how it is configured here: How to show and hide fields in the form conditionally | |
Conditions are written as filters, more on ConfiForms filters you can find here: ConfiForms Filters and ConfiForms Filters by example
|
To import via Atlassian Confluence Source Editor