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".
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.