Re: Required but empty


I think an empty string is clearly a zero-length string. While this
might be owed to a technical background I see the usability issue.
However, you could avoid whitespace-only strings from being submitted with

<xf:bind ... constraint="string-length(normalize-space(.)) > 0"/>

or by defining a subtype of xs:string disallowing whitespace-only
character sequences. This is a bit tedious for the for author, but I
don't think we should handle empty and whitespace-only strings equally
in general. I can't think of a half-decent use case for whitespace-only
strings right now, but I'm convinced some form author will have a use
case requiring white space to submit.


Erik Bruchez wrote:
> All,
> I have a doubt about the meaning of "empty" in the wording "required but
> empty" (which appears in 11.2.3 and 4.3.5).
> It seems that "empty" could either mean:
> 1. A zero-length string (clear technical interpretation)
> 2. A string empty as per #1 above, or a string with only white-space
>    (human-friendly interpretation)
> Imagine a user entering by error a space in an input field. Visually,
> with most agents (typically web browsers), you can't tell whether the
> field is empty according to #1 above, or contains white space. So to the
> user, the field is "empty".
> But if the XForms implementation implements #1, then this visually empty
> field will be considered non-empty, and pass submission even if required.
> This would favor an interpretation of "empty" where not only strictly
> empty strings are "empty", but also strings containing only white space.
> At the very least, the spec should say whether it means #1, #2, or
> implementation-dependent.
> -Erik

Ulrich Nicolas Lissť

Received on Tuesday, 29 May 2007 21:44:55 UTC