Add limit
Asked by Mr Ali:

Hello I am creating a confiform where user can put IDs. I put comma separate to put those IDs.But how can set a limit that user can't put more then 5 IDs on the form?please reply


Answers:
author: Alex Medved _ConfiForms_
body: Hi [@Mr Ali](/t5/user/viewprofilepage/user-id/4999655) and welcome to this community

Are you using a text field to enter IDs? Not something like a "multi-label" field in ConfiForms, no?

If a text field then you can set up a conditional validation rule, something like this

Demo: <http://recordit.co/zjfdGrSm0b>

Example storage format:

```
<ac:structured-macro ac:macro-id="43cb5d70-d629-40b8-9046-c3dd31f69854" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="a5e447e7-e1a8-4f0c-95e7-52e959a2bd4d" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="hideMetadata">true</ac:parameter>
<ac:parameter ac:name="type">Embedded</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="864de13f-9e71-400b-bcf0-5531e89fa067" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">IDS</ac:parameter>
<ac:parameter ac:name="fieldLabel">Enter IDS</ac:parameter>
<ac:parameter ac:name="fieldDescription">comma separated, but not more than 5</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="ea9621a5-8c59-4d06-bc75-d2886b5f17ab" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">IDS.split(,).asCount:&gt;5</ac:parameter>
<ac:parameter ac:name="fieldName">You are not allowed to enter more than 5 IDs</ac:parameter>
<ac:parameter ac:name="action">Validation rule</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
```

Hope it helps

Alex

comments: author: Mr Ali
body: Hi Alex,

I followed your suggested steps,but not working

I added two Macro

first one is Confiforms Form field Defination

Here I put

Field name IDS

Field label IDS

Field Type Text

Field description (optional) comma separated, but not more than 5

on the 2nd Confiforms Rules for Field Definition

Field name You are not allowed to enter more than 5 IDs

Condition IDS.split(,).asCount:\&gt;5

Action to execute \* Validation rule

Could you please check what need to change here


author: Alex Medved _ConfiForms_
body: The condition is

```
IDS.split(,).asCount:>5
```

(in the storage format it gets escaped to be XML friendly)

but in the demo I have recorded for you it is not escaped

Have you checked the screencast I have recorded for you?


author: Mr Ali
body: Yes, I checked the recorded video, followed all the steps.But still after putting all the condition and parameter not able to limit the form


author: Alex Medved _ConfiForms_
body: Really not sure I can help you here - provided a video, a storage format for the configuration for you to easy import...

Showed it works...

May be someone else can help better


author: Mr Ali
body: I tired again today,its working. Thank you Alex


Tags: confiforms

confluence-server

server