At Least One Checkbox Is Required

melvins138 13 May, 2014
I have created a multipage form, everything is working perfectly. Recently, I added a page of separate checkboxes for a questionnaire about the users qualifications.

Each qualification is set up like this:

Checkbox = (Some bit of information, like) I recently moved into the area. I moved on:
Dropdown for Month, Dropdown for Day, Dropdown for Year

Checkbox = I recently lost my job. I lost it on:
Dropdown for Month, Dropdown for Day, Dropdown for Year

None of the qualifications are required... but at least one needs to be checked on the page to be able to move on. I need this section as a screener, to make sure the user is actually qualified for this section of my site. For example: a person may not have moved to the area, but may have lost his job... or may be new to the area with a steady job, so neither checkbox can be required.

My question is how can I make at least one of the checkboxes required in a section, but not make individual checkboxes required?

If this doesn't make sense, I will try to explain it better.

Thanks,
Melvins138
Max_admin 14 May, 2014
Hi Melvins,

You can add this class to all of them:
validate['group[1]']


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
melvins138 19 May, 2014
Hi Max,

Thanks for the reply. However, I'm not seeing a Field Class on the checkbox item.

Is there another option for adding the validation to the class on a Checkbox?

Here is a screenshot of my options:
[IMG]http://i.imgur.com/DhBFr7y.jpg[/IMG]

I am using ChronoForms 4.0 on Joomla 3.1.5

Thanks,
Melvins138
Max_admin 19 May, 2014
Answer
1 Likes
Looks like this feature was not in v4! you will have to edit the form code then, or use a custom code element for the checkboxes.

in case you choose to edit the generated code, please note that the changes will be lost whenever you edit your form in the wizard again!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gasoline 19 May, 2014
I don't get this. Just finished all mij forms and everything is working fine. Except this. Need to validate that AT LEAST one box is ticket. Now the form can be send without clicking one.

Put in form:
<p>
<label>
<input type="checkbox" name="dag[]" id="checkbox" value="12 juni" class="checkbox validate['dag']" />
12 juni </label></p>
<p>
<label>
<input type="checkbox" name="dag[]" id="checkbox" value="14 juni" class="checkbox validate['dag']" />
14 juni

<br />
</label></p>

Where am I going wrong?
gasoline 19 May, 2014
Using J3.3 + CF5
Max_admin 19 May, 2014
Hi Gasoline,

You have a custom code form ?

Validating multiple checkboxes as one group needs this code inside their class attribute:
validate['group[1]']

where 1 is the group number, so using this code for all of them means validating all of them as group #1

But this is a custom solution and is not needed all the time!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gasoline 20 May, 2014
I still don't get it working. I'm not a programmer so I dont know exactly how this works. In my example:

<input type="checkbox" name="dag[]" id="checkbox" value="12 juni" class="checkbox validate['dag']" />
12 juni </label></p>
<p>
<label>
<input type="checkbox" name="dag[]" id="checkbox" value="14 juni" class="checkbox validate['dag']" />
14 juni

What should I have to put there instead of class="checkbox validate['dag']"

I now changed it to validate['group[dag]'] but does also does not work.
gasoline 20 May, 2014
Got it!

Sometimes things are difficult, but that's more my lack of knowledge.
I made a standard form from within CF5 and made the fields and requirements I need for my custom forms and than copied code. Works like a charm now. Everytime I work with CF5 I run into some troubles because of my unexperience with forms, but everytime when I learn more I'm surprised how well this extension works. Its really one of the greatest Joomla extensions I use. Thanks.

One last question, that I could not figure out.

The output of this checkbox group, when clicked multiple options, is present as:

1,3,4

But I need it to be outputed in email and on the webpage as:
1
3
4

or
* 1
* 3
* 4

What should I do to get that result?
Max_admin 20 May, 2014
1 Likes
Hi Gasoline,

Glad you figured it out!🙂

In order to change the formatting, you have to change the "separator" in the "Handle arrays", instead of ",", just use "<br>" or "*<br>"

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gasoline 20 May, 2014
Ha Ha,

That simple! Brillant.

Thanks.
This topic is locked and no more replies can be posted.