Required field yes/no depending on checkbox

Make a form field conditionally required based on a checkbox selection.

Overview

The issue is needing a phone number field to be mandatory only when a 'Call back' checkbox is selected.
In ChronoForms v6, use the checkbox's event settings to enable validation for the phone field when checked and disable it when unchecked, then add a required validation rule to the phone field itself.

Answered
ChronoForms v5
pk pklinke 30 Mar, 2017
Answer
Hi,

I need a field 'phone' which is required when a checkbox "Call back" is active. If 'Call back' isn't active, the field shall not required but available and can optional be filled out.

How can I do this?

Peter
Gr GreyHead 30 Mar, 2017
Hi Peter,

I think that the only way to do that is with a Custom Validation - I'd probably add it on the phone input element.

Bob
Max_admin Max_admin 30 Mar, 2017
Hi,

This feature is available in the new v6, you can install it beside v5 and give it a try.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
pk pklinke 01 Apr, 2017
Hi Max,

thank you.

I was testing V6 and this feature is available. But I do not understand, how to do the valiadation. There is only a text field and no documentation.

Peter
Max_admin Max_admin 01 Apr, 2017
Hi Peter,

In v6, inside the "Checkbox" settings, under "Events", add 2 events, when "Checked", "enable validation", then use the "yes/no" field name, and when "unchecked", "disable validation", "yes/no" field name.

The "yes/no" field is what type of field ? if its a "dropdown" then in the "validation" use this:
required:This field is required

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
pk pklinke 01 Apr, 2017
hi Max,

yes, this point is clear for me. But I do not understand how to validate the text field "phone". There is only a text field

Regards
Peter
Max_admin Max_admin 01 Apr, 2017
In that field just write this:

required:please provide your phone number!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
pk pklinke 02 Apr, 2017
Thank you,

is there a documentation available for v6?

Peter
Max_admin Max_admin 02 Apr, 2017
Hi Peter,

Unfortunately not yet, because its only few days old, hopefully some docs will be available soon.

But the work flow is the same as v5, apart of some different settings.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.