Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > quotes around some attributes in forms

Reply
Thread Tools

quotes around some attributes in forms

 
 
dorayme
Guest
Posts: n/a
 
      11-29-2005
I have noticed that type=hidden is often written without quotes.
For example see
http://www.scriptarchive.com/readme/...html#recipient who
seems to know what he is talking about. Is this so, or would it
be better practice to use quotes as in type="hidden"? He uses
the quotes on name="" and value="" but not on type="" I have
seen this before I think. Is there any good reason?

--
dorayme


 
Reply With Quote
 
 
 
 
David Dorward
Guest
Posts: n/a
 
      11-30-2005
dorayme wrote:

> I have noticed that type=hidden is often written without quotes.
> Is this so, or would it be better practice to use quotes as in
> type="hidden"?


In certain cases, authors may specify the value of an attribute without
any quotation marks. The attribute value may only contain letters (a-z
and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII
decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal
5. We recommend using quotation marks even when it is possible to
eliminate them.

-- http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
 
Reply With Quote
 
 
 
 
rf
Guest
Posts: n/a
 
      11-30-2005
dorayme wrote:

> I have noticed that type=hidden is often written without quotes.
> For example see
> http://www.scriptarchive.com/readme/...html#recipient who
> seems to know what he is talking about. Is this so, or would it
> be better practice to use quotes as in type="hidden"?


The HTML specs state that attribute values that contain special characters
(those other than alphanumeric and a few others) must be quoted. Attribute
values without special characters don't need to be quoted. Certainly if a
value contains a space it must be quoted.

> He uses
> the quotes on name="" and value="" but not on type="" I have
> seen this before I think. Is there any good reason?


Sloppy coding?

I use quotes for every attribute value rather than relying on remembering
correctly which special characters require quotes.

Additionally, some browsers will accept unquoted values *with* some special
characters. Some browsers will barf on exactly the same value.

1) Don't quote, risk making a mistake that *may not be picked up* in your
test browsers (should be by the validator though) but will break in one of
your viewers browser.

2) Quote everything and be quite safe.

The quotes are required in XHTML anyway, if that ever eventuates.

--
Cheers, Richard.
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      11-30-2005
> From: David Dorward <(E-Mail Removed)>
>
> dorayme wrote:
>
>> I have noticed that type=hidden is often written without quotes.
>> Is this so, or would it be better practice to use quotes as in
>> type="hidden"?

>
> In certain cases, authors may specify the value of an attribute without
> any quotation marks. The attribute value may only contain letters (a-z
> and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII
> decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal
> 5. We recommend using quotation marks even when it is possible to
> eliminate them.
>
> -- http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2
>


OK, so it can be strictly ok not to quote; but best to do anyway
so as not to have to remember which chars actually bring in the
requirement. Thank you DD and rf.

--
dorayme

 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      11-30-2005
With neither quill nor qualm, dorayme quothed:

> I have noticed that type=hidden is often written without quotes.
> For example see
> http://www.scriptarchive.com/readme/...html#recipient who
> seems to know what he is talking about. Is this so, or would it
> be better practice to use quotes as in type="hidden"? He uses
> the quotes on name="" and value="" but not on type="" I have
> seen this before I think. Is there any good reason?


I think it's to emphasize that the type is, indeed, hidden.

--
Neredbojias
Contrary to popular belief, it is believable.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WTB: I BUY SOFTWARE - CHECK AROUND - YOU PROBABLY HAVE SOME OF THEBELOW LAYING AROUND. Network/Software Buyer C++ 0 05-23-2010 07:14 PM
Asp.NET Javascript string, want to pass '(single quotes' within '(single quotes) Chris ASP .Net 1 03-24-2006 09:03 PM
Quotes/Double Quotes in Image Control Chris White ASP .Net 1 09-22-2004 06:22 AM
Forms Authentication question: How to have some pages open and some requiring forms authentication Eric ASP .Net 2 02-13-2004 02:14 PM
Multiline quotes - escaping quotes - et al Lawrence Tierney Java 3 12-24-2003 05:12 PM



Advertisments