Page MenuHomePhabricator

Allow using Status in HTMLForm's validation-callback
Closed, ResolvedPublicFeature

Description

Feature summary

Allow using Status in HTMLForm's validation-callback.

Use case(s)

Validation-callbacks that invoke a function/method returning a Status object. (Some services do)

Benefits (why should this be implemented?):

Currently, HTMLForm's submit-callback supports returning a Status object. This is convenient because it can represent multiple states, as well as contain warnings along with errors. These are localizable too, without relying on a ContextSource or MessageLocalizer. This convenience is missing in validation-callbacks, which forces use of strings (non-translatable) or ContextSource/MessageLocalizer, which is annoying when the form is created by a context-unaware factory (think PreferencesFactory, although that service needs context for other reasons)

Event Timeline

Change 928983 had a related patch set uploaded (by Mainframe98; author: Mainframe98):

[mediawiki/core@master] htmlform: Allow validation-callback to return Status instances

https://gerrit.wikimedia.org/r/928983

Change 928983 merged by jenkins-bot:

[mediawiki/core@master] htmlform: Allow validation-callback to return Status instances

https://gerrit.wikimedia.org/r/928983

matmarex assigned this task to Mainframe98.