...
This validation is possible to automate in ConfiForms by using the "ConfiForms Field Definition Rules" macro and using it's "Action" selected to "Validation Rule (dataset)"
We start with the form, which has only one field of type Dropdown, a registration Control macro to enable new registrations and "ConfiForms Field Definition Rules" macro with rules to check the dataset
...
we check for values "B" and count them using built-in variable [count]
Warning |
---|
Variable has changed from [count] to _count as in Accessing field values and properties |
Condition will match when a dataset has 3 records (where field value for field "myddfield" is "B") in it already
When it does the message to use will be shown
Storage format (configuration) for the whole solution:
Expand |
---|
Code Block |
---|
<ac:structured-macro ac:macro-id="e15f05e9-90a9-4725-bd84-af49bedf9a8c" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="56f6d25e-8791-4b69-9f83-93d3a9a85e29" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">myddfield</ac:parameter>
<ac:parameter ac:name="fieldLabel">My drop down field</ac:parameter>
<ac:parameter ac:name="values">false[A=this is A|B=this is B|C=this is C|]</ac:parameter>
<ac:parameter ac:name="type">select</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="a855e900-ea9c-44e7-b838-dfe48529a95d" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">myddfield:B AND _count:>3</ac:parameter>
<ac:parameter ac:name="fieldName">There are already 3 items of B value</ac:parameter>
<ac:parameter ac:name="action">Validation rule dataset</ac:parameter>
<ac:parameter ac:name="actionFieldName">myddfield</ac:parameter>
</ac:structured-macro>
<p> <ac:structured-macro ac:macro-id="639bf3c1-fa34-43c7-8dce-e8ab9f483f76" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p> </p>
</ac:rich-text-body>
</ac:structured-macro> </p>
<p> </p>
</ac:rich-text-body>
</ac:structured-macro>
|
More advanced storage to validate ANY option for max 3 items
Code Block |
---|
<ac:structured-macro ac:macro-id="e15f05e9-90a9-4725-bd84-af49bedf9a8c" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="56f6d25e-8791-4b69-9f83-93d3a9a85e29" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">myddfield</ac:parameter>
<ac:parameter ac:name="fieldLabel">My drop down field</ac:parameter>
<ac:parameter ac:name="values">false[A=this is A|B=this is B|C=this is C|]</ac:parameter>
<ac:parameter ac:name="type">select</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="a855e900-ea9c-44e7-b838-dfe48529a95d" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">myddfield:[entry.myddfield] AND _count:>3</ac:parameter>
<ac:parameter ac:name="fieldName">There are already 3 items of B'[entry.myddfield.label]' value</ac:parameter>
<ac:parameter ac:name="action">Validation rule dataset</ac:parameter>
<ac:parameter ac:name="actionFieldName">myddfield</ac:parameter>
</ac:structured-macro>
<p> <ac:structured-macro ac:macro-id="639bf3c1-fa34-43c7-8dce-e8ab9f483f76" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p> </p>
</ac:rich-text-body>
</ac:structured-macro> </p>
<p> </p>
</ac:rich-text-body>
</ac:structured-macro>
|
|
Info |
---|
Of course you can have as many validation rules as you want/need, with different conditions (which span across many fields if necessary) |
...