[Bug 13769] Whitespace-only values should be considered empty in required form fields

http://www.w3.org/Bugs/Public/show_bug.cgi?id=13769

Marat Tanalin (tanalin.com) <mtanalin@yandex.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|NEEDSINFO                   |

--- Comment #6 from Marat Tanalin (tanalin.com) <mtanalin@yandex.ru> 2011-08-31 10:24:46 UTC ---
(In reply to comment #4)
> Is this just for type=text?

It's for any text fields to be manually edited by user (textarea, input
type="text"/"url", etc.).

> The idea being to require that people
> type in more than just spaces?

The idea is that this is definition of what _all_ required fields are.

> If so, isn't the pattern attribute sufficient?
> (pattern=".*[^ ].*" for example)

Sufficient for what exactly? It's formally (maybe) "sufficient", but is
semantically wrong. Same as <div class="paragraph"> formally could be used
everywhere instead of structural paragraph element (<p>), but this would be
semantically wrong at all.

"required" attribute is part of semantics, while "pattern" attribute is just an
acceptable solution for rare custom cases. Leading/trailing whitespace in
text-field values is meaningless in most of cases (99%, if not all), so leading
and trailing whitespace should be trimmed _by default_ and this should not need
to use something more than just "required" attribute.

Just try to imagine terrible scenario when ALL required text fields in all
forms always have not only "required" attribute, but, additionally, pattern:

<input type="name" required pattern=".*[^ ].*" />
<input type="email" required pattern=".*[^ ].*" />
<textarea name="text" required pattern=".*[^ ].*"></textarea>

This would be a maintenance nightmare and really a "culmination" of HTML-spec
sense, purpose, and quality. Good HTML spec should not force web-developers to
use such harmful, nonsemantic, and unusable approaches. Instead, we should be
able to just use "required" attribute only:

<input type="name" required />
<input type="email" required />
<textarea name="text" required></textarea>

See also comment 5 by Jonas Sicking.

Thanks.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 31 August 2011 10:24:50 UTC