W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2002

HTML L2: Add HTMLFormControl interface as ancestor to form controls

From: Curt Arnold <carnold@houston.rr.com>
Date: Fri, 21 Jun 2002 09:08:53 -0500
Message-ID: <3D133375.9030405@houston.rr.com>
To: www-dom@w3.org

I believe it would be beneficial to add a HTMLFormControl interface to 
be used as a common ancestor interface for the form control interfaces. 
 This should have no end-user detectable affect from scripting languages 
since the existing interfaces share identically named attributes. 
 However, it would allow strongly-typed languages to operate on the 
common attributes of form controls without resorting to reflection.

For example, in JavaScript you could do:

var controls = form.elements();
for(var i = 0; i < controls.length; i++) {
    controls.item(i).disabled = true;
}

But you could not readily do the equivalent in Java.

The interface could look something like:

interface HTMLFormControl : HTMLElement {
    readonly attribute HTMLFormElement form;
    attribute DOMString name;
    attribute DOMString value;
   attribute boolean disabled;
    //
    //   these attributes are not currently in all form control interfaces
    //    
   attribute DOMString defaultValue;
   attribute DOMString accessKey;
   attribute long tabIndex;
}
Received on Friday, 21 June 2002 10:09:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:56 GMT