SunWuKung wrote:
Hi,
I am trying to throw a custom validation message (SomeMessage) when a
checkbox is not ticked, but so far I had no luck.

This works for other elements, but not for the checkbox:

elements.data_protection.type = "checkbox"
elements.data_protection.options.label = "SomeLabel:"
elements.data_protection.options.required = true
elements.data_protection.options.uncheckedValue = null
elements.data_protection.validators.notempty.validator = "NotEmpty"
elements.data_protection.validators.notempty.options.messages.isEmpty =
"SomeMessage"

You're close.  Validators are options.  Here's how I do it:

elements.firstname.type = "text"
elements.firstname.options.validators.notempty.validator = "notEmpty"
elements.firstname.options.validators.notempty.options.messages.isEmpty = "The first name is required."

Hope that helps,
Mike Wright

Reply via email to