Add limit

Mr Ali August 2, 2022

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 

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 3, 2022

Hi @Mr Ali 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

Mr Ali August 8, 2022

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

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 8, 2022

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?

Mr Ali August 8, 2022

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

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 8, 2022

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

Mr Ali August 9, 2022

I tired again today,its working. Thank you Alex

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events