How to check if a checkbox is checked

Validate a required checkbox in ChronoForms.

Overview

The issue occurs when trying to ensure a user agrees to a statement by checking a checkbox, but the standard validation options seem unclear.
Use the "not empty" server validation rule on the checkbox field to confirm it has been checked before form submission.

Answered
zo zoegoose 26 Jan, 2015
This must be so simple, but I can't figure out how to do it. 😶 I have a custom code form with a checkbox at the end that asks the user to agree to a statement. Most of my validation is really simple and was handled by the "not empty" ready made server validation options, but I can't figure out how to validate that checkbox. Thank you for any pointers.
Max_admin Max_admin 27 Jan, 2015
1 Likes
Hi Zoe,

Please try the "required" validation rule for the checkbox, I think that should handle it!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
zo zoegoose 28 Jan, 2015
Hi Max,

Thanks that sounds like what I'm looking for but I can't seem to find it. In my setup, I have dragged over a server validation box and have boxes such as "not empty", "empty", "alpha", etc. but no "required". I have created a form manually, not using the designer.

I suspect I need to add a little custom code, but am just not sure what it should be!

Zoë
Max_admin Max_admin 28 Jan, 2015
Answer
1 Likes
Hi Zoe,

Please use the "not empty" then, it should work fine since your checkbox must have a value anyway.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
zo zoegoose 28 Jan, 2015
You know I could swear I had tried that! Thanks so much that works perfectly.
Gr GreyHead 29 Jan, 2015
Hi zoegoose,

Please try Not Empty - I think that will work here.

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