I'd like to know if there's a way to add custom form validation to a module in joomla 3.7. I want my customer to be able to fill in two date fields [start] and [end] in the module administration. But I can't find a proper way to check something like "both fields are optional but if one field is filled in the other one must be a valid date too". I know I can do this with a Joomla component, but I'm coding a module here.
I've also read about coding and copying custom validation rule files to the administrator folder, but this feels a bit "dirty" to me because a module should work right after installation and be update-safe furthermore.
So my question is: Does anyone know a "proper" way to achieve this?
For server sided validation you can use a custom validation rule.
Joomla's documentation tutorial show it for a component but you can modify it for use with modules, without losing any future update ability:
Then you would create your custom rule class in the module's
rule
folder: