Re: I think this is a bug

On Thu, Jun 08, 2006 at 12:05:09PM -0400, Carlos Alberto P?rez Mu?oz wrote:
>    How come that this is a valid statement
>    http://validator.w3.org/check?uri=http://carlosccna.no-ip.org/SpecialFeatures/ContactForm.php
>    &Debug=Off&End=End
>    within a javascript, it has one (1) question mark and two (2) ampersand

In HTML, <script> elements contain CDATA. & characters have no special
meaning inside CDATA.

If you are using XHTML then you are either explicitly marking it as
CDATA (which has the same effect) or commenting out[1] the JavaScript
(and ampersands have no special meaning inside XML comments either).
 
>    and not valid <form name='myForm'
>    action='../SpecialFeatures/ContactForm.php?Debug=Off&End=End '
>    onSubmit='return CheckData( this.form )' method='post'> whithin
>    html, it has has one (1) question mark and only one (1) ampersand

In action attributes, & characters do have special meaning. They
indicate they start of an entity. As the material you quoted said, if
you want to mean "ampersand" then you have to use the entity for
ampersand - &amp; - rather than a raw ampersand (even inside attribute
values, and even inside URLs).

>    I have read, and there are millions of pages out there that use
>    the symbol & within forms submit, I was taught to do it that way.

It is a common error, and it is unfortunate that you were taught to
perpetuate it.

(I read the mailing list, please direct responses there and do not CC
me, thanks).

[1] A very bad idea that will cause the JS to break the moment it goes
near and XML parser.

-- 
David Dorward                                      http://dorward.me.uk

Received on Thursday, 8 June 2006 16:17:29 UTC