Page MenuHomePhabricator

Provide "minlength" and probably "fixedlength"? parameter to the "field" tag
Open, Needs TriagePublic

Description

A "maxlength" parameter is currently already provided, however I have heaps of use cases where a minimum length would come in handy too, e.g. all sorts of IDs like ISSNs, ISBNs or postal codes, phone numbers etc. I am not sure if a fixed length could be done with just a combination of min and max or if a fixed will be better for this case.

Event Timeline

Kghbln created this task.Jan 10 2016, 12:12 AM
Kghbln raised the priority of this task from to Needs Triage.
Kghbln updated the task description. (Show Details)
Kghbln added a subscriber: Kghbln.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptJan 10 2016, 12:12 AM

Have you already experienced a problem where someone entered a value that was too short for one of these fields? Or are you just worried that it could happen in the future?

Yes, though it is not yet a frequent thing. Currently I use the #len parser function to check the length and provide a warning with other functions after the page was saved. I do this for IBANs.

Alright. Have you considered, or tried, using the "regex" input type from Semantic Forms Inputs? That would let you validate not just the length but also the format of each field.

No, will have to dig into this though there are reports that this one is apparently broken. I'll see if that's the case. :)