Page MenuHomePhabricator

Allow HTMLForm text based elements to specify a minimum length
Closed, ResolvedPublicFeature

Description

Feature summary (what you would like to be able to do and where):
The HTMLTextField in HTMLForm does not allow the specification of the "minlength" attribute. The "maxlength" attribute is allowed, and is the inverse of this. Being able to specify the minlength would be helpful for cases where there is a minimum length to the field. Using this attribute would allow the browsers inbuilt validation to show a warning when the length is too small.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
Examples:

  • Special:CheckUser's checkuser block form requires that a tag be a certain length. Unless the checkuser presses submit and sees the tags were not added, this is not currently given as an error. Being able to show this to the checkuser before submission would be a good UI improvement.
  • Password field on Special:CreateAccount could use the minimum length attribute to indicate the minimum length needed for a password. While there exists JS based validation that shows a warning message, this does not help if JS is disabled. If JS was disabled this method would work at least for the password length.

Benefits (why should this be implemented?):
Consistency as "maxlength" is supported and for reasons mentioned above.

Extra details
While not supported by IE 11, this is only intended to be client side. If server side validation is added then IE 11 users will have the same experience as before, with not knowing the issue until submission.

Event Timeline

Change 865741 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] Allow uses of HTMLForm to specify a minlength for text based inputs

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

Change 865741 merged by jenkins-bot:

[mediawiki/core@master] Allow uses of HTMLForm to specify a minlength for text based inputs

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

Dreamy_Jazz claimed this task.