The documentation explains how to let know clientside_validation of custom #element_validate validations.

We currently have custom validations for various form elements using $form['#validate'][] = 'our_validation_function';, on a per form basis.

Can those #validate functions be recognized by clientside_validation?
Is there any advantage on using #element_validate?

Thanks !

Comments

attiks’s picture

Assigned: Unassigned » Jelle_S
Category: support » feature

#element_validate works on an element, #validate on the form

We'll have a look

Jelle_S’s picture

Status: Active » Fixed

Fixed in latest dev & updated the documentation.

EDIT:
In answer to your question:
#element_validate validates a single element in your form, so you're more likely to be able to reuse the function for other elements (e.g. checking for positive numeric values etc.)
#validate acts on the entire form, so you have more context.

There's no 'best practice' defined about their usage as far as I'm aware.

rafamd’s picture

attiks++
Jelle_S++

Thanks so much for making this module plain awesome! Everything's very clear.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.