Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ConfiForms validate number of chosable Multiselect options

Roman Manukjan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 27, 2023

Hi!

I am working on a ConfiForms form and using a multiselect field there.
We have a requirement to restrict the user's choices to exactly 3, meaning a validation should throw an error "please select exactly 3 options".

image.png

Unfortunately we are limited to the built-in functionalities of ConfiForms. I cannot use any custom user macros. Neither can I use a CSS or a HTML macro.

Is there a way to achieve this within the ConfiForms validation rules?


Thanks for any help!

Best regards,
Roman

1 answer

1 accepted

2 votes
Answer accepted
Alex Medved _ConfiForms_
Community Champion
August 27, 2023

Hi @Roman Manukjan and welcome to this community

There is no need to do anything “custom”, just use the “Validation rule” https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-Validationrule

And have it’s condition parameter set to something like this

Assuming the field is named “multi”

multi.asCount:>3

Ps, dont forget to set the “message to show when validation fails” parameter

Alex

Roman Manukjan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 27, 2023

Hi @Alex Medved _ConfiForms_

Thank you very much for this hint, It works perfectly! My problem was, that I was not aware, that I can use the 'as count' expression for checkbox groups.

As I need exactly 3 options to be selected, I've adapted the condition a little:


overweighting.asCount:>3 OR overweighting.asCount:<3


Cheers!
Roman 

Alex Medved _ConfiForms_
Community Champion
August 28, 2023

I am using the function mentioned here https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions

The condition for your case could be simplified to 

!overweighting.asCount:3

Alex

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events