While researching my other recent post on this board about custom fields (viewtopic.php?f=2&t=23750), I discovered something else that seems problematic: Custom fields are not included in the BugData object passed to plugins that handle EVENT_REPORT_BUG_DATA.
This would seem to imply that only the simplex validations defined by the field's regexp and min/max length constraints can be performed. Complex validations of custom fields, such as cross-checking values against other fields or against the context (user, project, etc.), or driving side-effects off custom field values, apparently aren't possible to implement (easily) via plugins.
Something of a workaround may be possible, in the sense that if the custom fields were submitted by the form, their raw values should still be in $_POST, and so with some effort (and duplication of existing code) they could be acquired by the plugin. But really, being able to access them as properties of the BugData object would be substantially more convenient.
I've looked for an existing bug for this on https://www.mantisbt.org, but none of the bugs that mention "EVENT_REPORT_BUG_DATA" seem related. So either I'm the only person who's interested being able to do this, or I'm using the wrong search terms.
(Or maybe what I want to do is possible by some other mechanism I haven't discovered yet?)
Thoughts?
Custom field validation by plugin not possible?
Moderators: Developer, Contributor
Re: Custom field validation by plugin not possible?
Certainly not exactly what you are asking for, but might help https://www.mantisbt.org/wiki/doku.php/ ... stomfields