Home › Forums › Quform WordPress › Limit Checkbox Selections Across Multiple Checkbox Fields
- This topic has 5 replies, 2 voices, and was last updated 1 year, 3 months ago by Ally.
- AuthorPosts
- April 28, 2023 at 6:46 am #35451colourcraftParticipant
I want to style a number of checkboxes so that a maximum of 8 checkboxes can be selected, but need the checkboxes to have sub-headers separating some of them for styling purposes. It is for a swatch selection form, so as an example we would have is below… (The small ‘x’ representing the checkbox symbol)
~~~ Blue Colours~~~
x Kingfisher Blue
x Baby Blue
x China Blue
x Vintage Blue~~~Green Colours~~~
x Forest Green
x Racing Green
x Vintage GreenI can’t see an easy way of having dividers in between certain checkbox break points when using just one single field, so I presume, unless it is possible, that the only way would be to have separate checkbox fields for each of the colour groups, with the sub-headers as html fields to separate them.
I can see that you have some example code to limit the number of checkbox selections for a specific field ID, but is there a way, for example, to restrict the maximum number of checkbox selections to, say, 8 selections spread across 5 different checkbox ID’s
If the example code could be supplied to do this, or if there is a way to introduce html code to break up checkboxes with sub header styling within a single checkbox ID, that would be fantastic.
May 1, 2023 at 11:54 am #35459AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
May 2, 2023 at 2:43 pm #35462colourcraftParticipantI’ve tried this, but think it would be easier styling wise to just do the calculation check across multiple check box fields, just for ease of editing in future from our end. So if its possible, it would be great to see the code to count selected items across multiple checkbox field s to only allow a maximum of 8 entries (as an example)…
May 3, 2023 at 10:17 am #35465AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 16, 2023 at 11:02 am #35607colourcraftParticipantThank you for this code, it works well.
One final request, these fields are on page 1 of our form. Is there a way to add some javascript so that when the customer clicks on the submit button, it also checks all these fields as a group to make sure that at least 1 checkbox within the group of fields has been selected before continuing.
- This reply was modified 1 year, 3 months ago by colourcraft.
June 16, 2023 at 12:32 pm #35612AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.