#24 Use css 'width', not 'size', for length-constrained controls

open
nobody
None
5
2012-12-21
2010-03-05
No

According to the compatibility notes of [1], the 'size' on a <input size='66'> element must not be used, since it is a visual design attribute, and a CSS must be used instead.

The problem becomes appearent when used with xml-schema types that define long string-lenghts, i.e. 100 characters,
then input control on the page becomes extremely long and it is impossible to change its appearence with CSS since direct attributes take precendence.

The problematic statement reside (for svn revison 357) in file trunk/src/js/controls/XFInput.js.xml:127
if (length) {
input.size = length; // Must use CSS instead
} else {
input.removeAttribute("size");
}

Note that the funcionality of length-constraint schema-types will not be affected since right above in the filem, the 'maxLength' attribute is set,
which guarantees the correct behavior of the field reagrding string-length.

[1]http://www.w3schools.com/TAGS/att_input_size.asp

Discussion