Re: Proposal of extension to element in HTML

2014-09-08 13:08, Jens O. Meiert wrote:
> The first line seems to sum it up quite well: “I propose an extension 
> to the fieldset element: a required attribute. The required attribute 
> is similar to the required attribute of the input element.” 

More exactly, the attribute would have an integer value and its value 
would specify the minimum number of fields that need to be filled in.

The most important thing with extension proposals is usually the 
existence and relevance of use cases. I think for this, use cases are 
easy to imagine and describe. A very simple and common case is that the 
user is expected to provide at least one way of contacting him. Another 
scenario is a form where the user can select (say) up to three optional 
items from a list.

The next question is implementability. This does not sound excessively 
complicated, even though it introduces yet another aspect that browsers 
would need to consider in form validation.

I don't think the name "required" would be suitable, since an attribute 
with that name is already in use as a so-called boolean attribute, and 
an attribute with a different set of values would be confusing.

On the functional side, it would be logical to have also an attribute 
for specifying the maximum number of fields that must be filled in. I 
wonder if "min" and "max" might be suitable names for such attributes.

Using <fieldset> in this context is problematic, since it has default 
rendering that suggests close association between fields.

Introducing a new element for grouping sounds awkward. Introducing the 
attribute for the <div> element would be somewhat odd too.

But before going into such issues, a discussion about the usefulness of 
a feature at an abstract level is needed: should there be a possibility 
in HTML to specify that some minimum number of fields among some 
designated set of fields must have values, to pass form data validation 
in a browser? And should there be a corresponding way of specifying the 
maximum too?

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

Received on Monday, 8 September 2014 10:31:57 UTC