Validation of Manager Fields is a common requirement for countless scenarios. What if I want to require a value to be not empty. What if i need a TV to be a number in a specific format. Or an entry to be only composed of max. 2 words. Or really anything I could accomplish with a regexp. What if i want to use the api to restrict it’s value dependending on the document tree position or the selected template.
I could not believe this is not possible at first and have searched a lot. I came across the MM addon and tried it. It is okay but limited to javascript validation. If your input validation is important that’s a nice addition to serverside checks but not more.
Do I really need to put the entire manager aside and code a
Pubkit like frontend management UI?
There are plugin events that are triggered which makes you believe you could roll any kind of validation easily. As it turns out you cannot have a plugin show a message in the manager or prevent the saving event itself. Why the heck not? I thought MODx’s strength is supposed to lie in customization!
-
To be fair I’ve seen a pioneer case where something like this has worked
in revolution. The redirect approach still feels like a workaround needed because validation extensibility is simply missing. Also I need it in Evolution and I need it to be feasible without too much effort and I’m very frustrated by this.