[Django] #28480: Nonstandard "minlength" property to <input/>

9 views
Skip to first unread message

Django

unread,
Aug 8, 2017, 12:29:38 PM8/8/17
to django-...@googlegroups.com
#28480: Nonstandard "minlength" property to <input/>
-------------------------------------+-------------------------------------
Reporter: Tomáš | Owner: nobody
Pecina |
Type: | Status: new
Uncategorized |
Component: HTTP | Version: 1.11
handling | Keywords: minlength input
Severity: Normal | form field
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
CharField with a "minlength" argument generates "minlength" property,
which is (rightly) complained of by some HTML validators. As W3C does not
recognize this property as legitimate (and the question is if they ever
will), I belive it should not be generated. If anyone needs it, s/he can
always add it in the attrs dictionary, or subclass CharField.

--
Ticket URL: <https://code.djangoproject.com/ticket/28480>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 8, 2017, 1:55:25 PM8/8/17
to django-...@googlegroups.com
#28480: Nonstandard "minlength" property to <input/>
-------------------------------------+-------------------------------------
Reporter: Tomáš Pecina | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.11
Severity: Normal | Resolution: invalid
Keywords: minlength input | Triage Stage:
form field | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* type: Uncategorized => Bug
* component: HTTP handling => Forms
* resolution: => invalid


Comment:

My research didn't confirm that the `minlength` attribute is invalid.
https://www.w3.org/TR/html5/forms.html#the-maxlength-and-minlength-
attributes
http://caniuse.com/#feat=input-minlength
Perhaps you can cite your source if you believe otherwise.

--
Ticket URL: <https://code.djangoproject.com/ticket/28480#comment:1>

Django

unread,
Aug 8, 2017, 10:43:51 PM8/8/17
to django-...@googlegroups.com
#28480: Nonstandard "minlength" property to <input/>
-------------------------------------+-------------------------------------
Reporter: Tomáš Pecina | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.11
Severity: Normal | Resolution: invalid
Keywords: minlength input | Triage Stage:
form field | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tomáš Pecina):

Sure; https://www.w3schools.com/tags/tag_input.asp and, which is even more
relevant, please try this:


{{{
echo '<input minlength=3>' | tidy
}}}

I'm using libtidy to check all HTML during unit testing on my project
(https://github.com/tompecina/legal), and I had to drop minlength because
the output did not pass the test.

In my opinion, it is a matter of good policy not to include any
nonstandard or proprietary HTML markup; it will have no impact on the
validation as the MinLengthValidator is automatically added.

--
Ticket URL: <https://code.djangoproject.com/ticket/28480#comment:2>

Django

unread,
Aug 9, 2017, 3:22:06 AM8/9/17
to django-...@googlegroups.com
#28480: Nonstandard "minlength" property to <input/>
-------------------------------------+-------------------------------------
Reporter: Tomáš Pecina | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.11
Severity: Normal | Resolution: invalid
Keywords: minlength input | Triage Stage:
form field | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz):

https://validator.w3.org/nu/ does not complain. The latest draft of HTML
5.2 on http://w3c.github.io/html/single-page.html does include the
`minlength` attribute. I confirm this ticket's resolution. You may try
opening a ticket in tidy bugtracker instead.

--
Ticket URL: <https://code.djangoproject.com/ticket/28480#comment:3>

Django

unread,
Aug 9, 2017, 4:39:38 AM8/9/17
to django-...@googlegroups.com
#28480: Nonstandard "minlength" property to <input/>
-------------------------------------+-------------------------------------
Reporter: Tomáš Pecina | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.11
Severity: Normal | Resolution: invalid
Keywords: minlength input | Triage Stage:
form field | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tomáš Pecina):

That's a good point, Claude. HOWEVER, we should realize that minlength is
not the same thing as maxlength, conceptually, and browser developers are
right in not implementing the former very eagerly. With maxlength, there
is a clear and evident visual and possibly acoustic feedback: when the
limit is reached, the user's keypresses are not displayed, and perhaps, a
warning beep is produced. On the other hand, there is no such aid with
minlength. Therefore, it might be wiser to let the Django validator do the
job, and inform the user by a message such as "Currency code must consist
of exactly three characters." By hardcoding the minlength property (which
is not that easy to remove), we may be doing a disservice to the
application developer. Please, give the issue a second thought.

--
Ticket URL: <https://code.djangoproject.com/ticket/28480#comment:4>

Django

unread,
Aug 9, 2017, 12:56:47 PM8/9/17
to django-...@googlegroups.com
#28480: Nonstandard "minlength" property to <input/>
-------------------------------------+-------------------------------------
Reporter: Tomáš Pecina | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.11
Severity: Normal | Resolution: invalid
Keywords: minlength input | Triage Stage:
form field | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz):

Tomáš, I'd suggest that you explain your issue on the django-developer
mailing list.

--
Ticket URL: <https://code.djangoproject.com/ticket/28480#comment:5>

Django

unread,
Aug 9, 2017, 1:20:51 PM8/9/17
to django-...@googlegroups.com
#28480: Nonstandard "minlength" property to <input/>
-------------------------------------+-------------------------------------
Reporter: Tomáš Pecina | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.11
Severity: Normal | Resolution: invalid
Keywords: minlength input | Triage Stage:
form field | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tomáš Pecina):

No, why? I simply think it's not a good idea to use automatically every
property simply because it is there, and caution is needed because certain
checks are better performed on the server (or by JavaScript) than in the
browser. You think otherwise, and you are the boss here, so I supressed
the property manually in my code and this is the end of the story for me.
Thanks for your time, anyway!

--
Ticket URL: <https://code.djangoproject.com/ticket/28480#comment:6>

Django

unread,
Aug 9, 2017, 5:34:31 PM8/9/17
to django-...@googlegroups.com
#28480: Nonstandard "minlength" property to <input/>
-------------------------------------+-------------------------------------
Reporter: Tomáš Pecina | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.11
Severity: Normal | Resolution: invalid
Keywords: minlength input | Triage Stage:
form field | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz):

Replying to [comment:6 Tomáš Pecina]:


> You think otherwise, and you are the boss here

That's why I suggested the mailing list, so the decision could be
discussed by more people than just one or two "bosses".

> so I supressed the property manually in my code and this is the end of
the story for me. Thanks for your time, anyway!

If you found a solution working for you, that's great.

--
Ticket URL: <https://code.djangoproject.com/ticket/28480#comment:7>

Reply all
Reply to author
Forward
0 new messages