473,856 Members | 1,470 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

input element: checked attribute


Hello,

I would like to know why the W3C decided not to make the following
valid XHTML:

<input checked type="radio" name="foo" value="bar" />FooBar

forcing people to write the following to make the document comply:

<input checked="checke d" type="radio" name="foo" value="bar" />FooBar

It seems kind or redundant to have the "checked" explicitly written down,
doesn't it?

Regards,

Neil

Jul 20 '05 #1
8 16241
Neil Zanella wrote:
I would like to know why the W3C decided not to make the following
valid XHTML:

<input checked type="radio" name="foo" value="bar" />FooBar


Becuase XHTML is an XML application and XML does not allow it.

The only differences between HTML 4.01 and XHTML 1.0 are those enforced by
the move to XML.

--
David Dorward http://david.us-lot.org/
Redesign in progress: http://stone.thecoreworlds.net/
Microsoft announces IE is dead (so upgrade):
http://minutillo.com/steve/weblog/20...ces-ie-is-dead
Jul 20 '05 #2
Neil Zanella wrote:
Hello,

I would like to know why the W3C decided not to make the following
valid XHTML:

<input checked type="radio" name="foo" value="bar" />FooBar

forcing people to write the following to make the document comply:

<input checked="checke d" type="radio" name="foo" value="bar" />FooBar

It seems kind or redundant to have the "checked" explicitly written down,
doesn't it?


Yeah, it does seem redundant. But according to the W3C that's how it has
to be: "XML does not support attribute minimization. Attribute-value
pairs must be written in full. Attribute names such as compact and
checked cannot occur in elements without their value being specified."
<http://www.w3.org/TR/xhtml1/#h-4.5>

IMHO they should have changed the name of the attributes to something
that makes a bit more sense, e.g. <input type="text" status="checked " >
or <dl display="compac t">, something along those lines. But I suppose
they had valid reasons not to do that; you could probably check the
appropriate W3C mailing lists for the details if you're interested.
Matthias

Jul 20 '05 #3
Matthias Gutfeldt <wo***@gmx.at > wrote:
Yeah, it does seem redundant. But according to the W3C that's how
it has to be: "XML does not support attribute minimization.
That's why XML has X, for eXtended (or was it eXtensible? who cares),
to hide the simple fact that it is a banal simplification of SGML. :-)
Attribute-value pairs must be written in full. Attribute names such
as compact and checked cannot occur in elements without their value
being specified." <http://www.w3.org/TR/xhtml1/#h-4.5>
It has often been pointed out that this is a misrepresentati on of
facts. By SGML rules, an attribute specification like CHECKED (in SGML,
we are allowed to use upper case whenever we like) is a shorthand
notation based on using the _value_ of an attribute alone. So it's
really the attribute name (and the delimiter, "=" in the reference
concrete syntax) that can be omitted, in certain situations.

I wonder which possibility is worse: people who wrote the XHTML
specification didn't know this, or they decided to lie about it. Let's
be reasonable and assume that it was a typo. Or a cow flew by.
IMHO they should have changed the name of the attributes to
something that makes a bit more sense, e.g. <input type="text"
status="checked " > or <dl display="compac t">,
I've asked myself that question recently, though as relating to the
_original_ decision to use attribute names like "checked" or "compact".
I can't see any other reason than thinking in terms of "Boolean
attributes", which is a non-SGML concept of course - but natural if you
are _really_ just defining a simplistic and presentation-oriented
markup system. (In HTML history, "checked" is a novelty, whereas
"compact", a presentational attribute if you ever saw one, is an old
one, and oddly left unimplemented, in most browsers.)
But I suppose they had valid reasons not to do that;


Hardly anything else than compliance with old browsers.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #4
David Dorward <do*****@yahoo. com> wrote in message news:<bd******* ************@ne ws.demon.co.uk> ...
Neil Zanella wrote:
I would like to know why the W3C decided not to make the following
valid XHTML:

<input checked type="radio" name="foo" value="bar" />FooBar


Becuase XHTML is an XML application and XML does not allow it.


You mean to tell me that XML requires all element attributes to have explicit
values in any XML application? Is this a deficiency in XML or in the power of
DTDs themselves? BOTH XHTML and HTML have the same line:

checked (checked) #IMPLIED -- for radio buttons and check boxes --

in the input element's attribute list:

$ vim +/checked http://www.w3.org/TR/html401/strict.dtd
$ vim +/checked http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd

Regards,

Neil
Jul 20 '05 #5
"Jukka K. Korpela" <jk******@cs.tu t.fi> wrote in message news:<Xn******* *************** *******@193.229 .0.31>...
Matthias Gutfeldt <wo***@gmx.at > wrote:
Yeah, it does seem redundant. But according to the W3C that's how
it has to be: "XML does not support attribute minimization.
That's why XML has X, for eXtended (or was it eXtensible? who cares),
to hide the simple fact that it is a banal simplification of SGML. :-)
Attribute-value pairs must be written in full. Attribute names such
as compact and checked cannot occur in elements without their value
being specified." <http://www.w3.org/TR/xhtml1/#h-4.5>


It has often been pointed out that this is a misrepresentati on of
facts. By SGML rules, an attribute specification like CHECKED (in SGML,
we are allowed to use upper case whenever we like) is a shorthand
notation based on using the _value_ of an attribute alone. So it's
really the attribute name (and the delimiter, "=" in the reference
concrete syntax) that can be omitted, in certain situations.

I wonder which possibility is worse: people who wrote the XHTML
specification didn't know this, or they decided to lie about it. Let's
be reasonable and assume that it was a typo. Or a cow flew by.
IMHO they should have changed the name of the attributes to
something that makes a bit more sense, e.g. <input type="text"
status="checked " > or <dl display="compac t">,


I've asked myself that question recently, though as relating to the
_original_ decision to use attribute names like "checked" or "compact".
I can't see any other reason than thinking in terms of "Boolean
attributes", which is a non-SGML concept of course - but natural if you
are _really_ just defining a simplistic and presentation-oriented
markup system.


If they were boolean attributes then they would have two values, but
they
are single-valued attributes. Their presence is associated with one
value
and their absense with the other boolean value if you really want to
think
of it that way. But absense of values makes me think of relational
databases
where some entries can be NULL. In this case it's like having
something which
can be either true or null, but not false. Basically what we are
seeing is
nonstandard representation of facts. A duality between something that
is
either true or false and something that is either present or absent.
In either case we have two things, but it's late, and I'm just going
on about nothing I suppose.

Anyhow, the options in the spec would better have been checked="yes"
and checked="false" or something like that, with checked being
#IMPLIED and
"false" being the default, as follows:

<!ATTLIST input ...
checked (true|false) #IMPLIED "false"
.... >

instead of

<!ATTLIST input ...
checked (checked) #IMPLIED
.... >

But then again there's the problem that for checkboxes one always has
to be checked, so having a default of false is not good. Perhaps the
W3C group just did what was right after all (except for there is
nothing wrong with SGML style attribute minimization from what
I can see: it's just the W3C group really wanted to simplify
things for the parser to come up with a smaller grammar).

Regards,

Neil
(In HTML history, "checked" is a novelty, whereas
"compact", a presentational attribute if you ever saw one, is an old
one, and oddly left unimplemented, in most browsers.)
But I suppose they had valid reasons not to do that;


Hardly anything else than compliance with old browsers.

Jul 20 '05 #6
nz******@cs.mun .ca (Neil Zanella) wrote:
If they were boolean attributes then they would have two values,
but they
are single-valued attributes. Their presence is associated with one
value
and their absense with the other boolean value if you really want
to think
of it that way.
That's what the W3C specs mean by "Boolean attributes". BTW, please fix
your newsreader: it generates odd variation in line length and
apparently forces you to quote too much.

Their meaning for "Boolean" is 'present or absent'. They really call
them "Boolean".
Anyhow, the options in the spec would better have been
checked="yes" and checked="false"
Well, they were not that _consistent_ in making them Boolean.
<!ATTLIST input ...
checked (true|false) #IMPLIED "false"
... >
Cui bono? Then checked="true" would fail on browsers that never heard
of this novelty.
But then again there's the problem that for checkboxes one always
has to be checked,
No there isn't. You're confusing them with radio buttons, and you're
confusing semantics with syntax,
it's just the W3C group really wanted to simplify
things for the parser to come up with a smaller grammar).


No, they actually played under the constraints of making the world safe
for XML and of not breaking old code or old browsers.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #7
Terje Bless <li*******@pobo x.com> wrote:
- - the whole SHORTTAG issue stems
from wanting to make HTML (SGML) less verbose and saving some
typing[0].


Surely. But my question was why the attribute names were selected the
way they were.

The apparent history is that early browsers supported keyword-only
attributes like CHECKED or CENTER. There was hardly much thinking in
SGML terms then, though HTML had partly been inspired by some simple
SGML based markup systems (and a rather random choice of simple tags
was chosen from them). Later, retrofitting HTML into SGML in theory,
something had to be done. CENTER was made into a value of ALIGN, with
an enumeration of values, so that <h1 center> is shorthand for
<h1 align=center>. These days few people realize this, and even fewer
remember the browsers where it actually worked.

But the obvious choice had been something like making CHECKED the value
of an attribute like STATUS with an enumeration of values like
UNCHECKED, CHECKED or maybe just CHECKED. This would fit into the idea
of using CHECKED alone. But maybe they though that authors would fail
to understand the principle that the attribute _name_ can be omitted in
certain cases. Or maybe they (the people who did the retrofitting)
failed to understand or remember the principle.

As regards to why SHORTTAG features were officially removed in XML and
XHTML, the obvious answer is that the real complexity of this SGML
feature was understood up to the point that they shouted "oh no!",
without thinking further to consider why the designers of SGML had
still included it. I don't think the decision will be taken back, no
matter what you could explain. But it's quite possible that SGML will
be reinvented some day, in a simplified but not brutally simplified
form.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #8
In article <Xn************ *************** **@193.229.0.31 >,
Jukka K. Korpela <jk******@cs.tu t.fi> wrote:
Terje Bless <li*******@pobo x.com> wrote:
- - the whole SHORTTAG issue stems
from wanting to make HTML (SGML) less verbose and saving some
typing[0].
Surely. But my question was why the attribute names were selected the
way they were.


Ah, sorry. Through my tinted glasses I misread your message.

But the obvious choice had been something like making CHECKED the value
of an attribute like STATUS with an enumeration of values like
UNCHECKED, CHECKED or maybe just CHECKED. This would fit into the idea
of using CHECKED alone. But maybe they though that authors would fail
to understand the principle that the attribute _name_ can be omitted in
certain cases. Or maybe they (the people who did the retrofitting)
failed to understand or remember the principle.
IIRC this ("checked") was the specific example used in the messages I
referred to, so it is likely that this was a result of SGML awareness
having snuck in, but only partially (which explains "align").

As regards to why SHORTTAG features were officially removed in XML and
XHTML, the obvious answer is that the real complexity of this SGML
feature was understood up to the point that they shouted "oh no!",
without thinking further to consider why the designers of SGML had
still included it.
Well, as mentioned, the timing of this as compared with the publication
of "Annex K"[0] makes me think that they simply failed to take into
account, or chose to ignore, the finer granularity offered by K.3.5
("Markup minimization features") of WebSGML when that particular
decision was made. Either that or the bulk of those involved failed to
notice the SGML Declaration for XML through all those furiously waving
hands.

I don't think the decision will be taken back, no matter what you
could explain.
I would settle for a reasoned "WONTFIX", but I'm still hoping it may be
treated as an erratum. It would certainly make _my_ life much easier
and would break very very few actual implementations (w3m is the only
candidate I can think of that may actually implement these features).

But it's quite possible that SGML will be reinvented some day, in a
simplified but not brutally simplified form.


YM "XML 2.0", no? As best I can tell the XML world is busily
reinventing SGML ass end first. By XML 3.0 they'll have achieved
feature parity and removed most of the most egrarious misfeatures. By
XML 4.0 we may begin to see something genuinely new...

[ Not really, but it sure feels that way some times. :-( ]


[0] - ISO/IEC JTC1/SC34 N0029; ISO 8879 TC2
<http://www.y12.doe.gov/sgml/sc34/document/0029.htm>

--
T.E.R.J.E. - Technician Engineered for Repair and Justified Exploration
B.L.E.S.S. - Biomechanical Lifeform Engineered for Scientific Sabotage
Jul 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
37880
by: F. Da Costa | last post by:
Hi, Does the following indeed imply that this event is NOT called when an <input type="checkbox" is toggled? This would thus imply the usage of the onClick handler instead (assuming an action needs to be invoked on check/ uncheck). W3C Recomendation: 18 Scripts onselect = script The onselect event occurs when a user selects some text in a text field. This attribute may be used with the INPUT
5
2526
by: Gregg | last post by:
Hello all, I have been banging my head over a problem that I am having reading a comma seperated file (CSV) that can contain from 1 to 10,000 records. My code snipit is as follows: **Start code snipit** Dim strCustFullName as string Dim strCustAddr1 as string
8
2041
by: Calan | last post by:
I have a server-side ASP script that dynamically creates an input form from a database table. The table contains a field name, the table where values are stored, type of input control, value for a label, etc. What I need to do is create a JS validation routine that will check each control for valid input, regardless of what the control name is. If it is a "select", it needs to verify the index is > 1. If it is an "input", it needs to...
6
14459
by: Csaba | last post by:
I'd like to have the cursor in the login form's username input text field when users load the login page. It works fine with the following implementation: <body onload="document.login.username.focus();"> <form name="login" method="post" action="<?=$PHP_SELF?>"> <input type="text" name="username" onLoad="self.focus();"> The problem is that the input field's name cannot be simly "username", because it posts an element of an array,...
12
2177
by: Jim Tome | last post by:
Hi, I am trying to change and pass the value of a hidden input type on a form tag to a cgi processing script based on the value of a checkbox within the form: function CheckBoxes () { if (document.MyForm.CheckBox1.checked) { document.MyForm.recipient.value = "2"; document.MyForm.submit();
4
2757
by: multimatum2 | last post by:
Hello, I need to enable/disable input text forms... But... I need to have the same style (color...) in both modes.. Could you help me ? Thanx a lot A small sample... <HTML><HEAD><TITLE></TITLE></HEAD>
3
2827
by: chuck | last post by:
Hi, This is a test for a larger form i am working on. I want to have a real time display of the radio button value when selected. I tried with various event handlers with varying success. The code below works in mac/win firefox, other browsers don't handle it at all. I have tried using onclick, and that buggers it in all browsers. <script type="text/javascript"> function updateSize()
2
3398
by: Neil Zanella | last post by:
Hello, The book "Programming ASP.NET" by O'Reilly, an excellent source of ASP.NET information indeed, specifies that along with the runat="server" attribute an id attribute should also be specified in order to make use of variable names. However, the XHTML specification found at the following site: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd does not state anything regarding an id attribute. Despite this fact, Web Matrix is...
11
19242
by: C.W.Holeman II | last post by:
I what to hide an input element and the following text. I have the selector for the input working and just need to grab the text following it. CSS: form{ display:table; text-align:center; }
0
9922
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10702
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10800
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10391
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7934
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5962
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4584
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4177
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.