CMS Development

j_quibler
Member

Make *at least* one of the fields in a fields_group mandatory

SOLVE

I am working on a module where a person can have multiple contact information, but at least one is required, (meaning one or more must be filled in). In the example below, member_item is a repeatable group.

 

sc-2010280-145057.png

 

 How can I force the required option for a group of fields so that if at least one of the fields in the group is filled in correctly, the validation passes, otherwise it fails.

I notice the group does not have any required settings, only individual fields have.

 

 

0 Upvotes
1 Accepted solution
j_quibler
Solution
Member

Make *at least* one of the fields in a fields_group mandatory

SOLVE

Thanks Kevin. Your reply helped, in that I searched for a different angle towards this. Knowing I can't affect the way validation works, I made the whole contacts section a repeater group with only two fields: contact_type (a choice field with 3 choices: phone, email and linkedin) and contact_data, and set the number of minimal repetitions to 1. The requirements I work with were pretty speciffic in that I were to have *any* of the fields filled in and couldn't simply make one of them required.

View solution in original post

0 Upvotes
2 Replies 2
Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

Make *at least* one of the fields in a fields_group mandatory

SOLVE

Hey @j_quibler 

 

I'm not entirely sure that this is possible. Maybe using the CLI tools?

 

If I were in your shoes, I would require as a minimum the email address (from a UX perspective probably the easiest for a customer to give out), create a dropdown for the user to select their 'prefered' method of contact (if thats the purpose), and have the other fields show up conditionally based on the dropdown choice.

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
j_quibler
Solution
Member

Make *at least* one of the fields in a fields_group mandatory

SOLVE

Thanks Kevin. Your reply helped, in that I searched for a different angle towards this. Knowing I can't affect the way validation works, I made the whole contacts section a repeater group with only two fields: contact_type (a choice field with 3 choices: phone, email and linkedin) and contact_data, and set the number of minimal repetitions to 1. The requirements I work with were pretty speciffic in that I were to have *any* of the fields filled in and couldn't simply make one of them required.

0 Upvotes