Page MenuHomePhabricator

HTMLSelectAndOtherField has some issues with the default value and validation
Closed, ResolvedPublic

Description

The default value returned by HTMLSelectAndOtherField::getDefault, null, does not pass the validation check, which expects an array with the second item a valid select option. This means that the form returns errors if the field is disabled, with no default value set.

Additionally, HTMLSelectAndOtherField::loadDataFromRequest builds an array that passes the validation check, but contains null as the final value, causing T222170.

Also, the validation check when the field is required only checks whether the select value is empty; it should also check whether the text value is empty.

Event Timeline

Change 517147 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/core@master] Fix some issues with HTMLSelectAndOtherField default and validation

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

Change 517147 merged by jenkins-bot:
[mediawiki/core@master] Fix some issues with HTMLSelectAndOtherField default and validation

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

Change 517474 had a related patch set uploaded (by Krinkle; owner: Tchanders):
[mediawiki/core@wmf/1.34.0-wmf.8] Fix some issues with HTMLSelectAndOtherField default and validation

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

matmarex reopened this task as Open.
matmarex assigned this task to Tchanders.
matmarex subscribed.

(oh sorry, I didn't notice the backport)

Change 517474 merged by jenkins-bot:
[mediawiki/core@wmf/1.34.0-wmf.8] Fix some issues with HTMLSelectAndOtherField default and validation

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