AmandaF Posted April 6, 2009 Share Posted April 6, 2009 I'm writing a php script that involves generating an input element for an xhtml form, and I wanted it to throw an error if the arguments for the name, id, or class attribute of the element isn't valid for xhtml 1.0 strict. The official specification (http://www.w3.org/TR/xhtml1/), as far as I can tell, only gives a definition for ID fragments, not the full id attribute. Unofficial sites (blogs, forums, etc) seem to say that IDs and names are a letter followed by one or more letters, numbers, hyphens, underscores, colons and periods. (i.e. /[a-z0-9][-a-z0-9_:.]*/i) If that's the case, doesn't that mean the syntax for making a name attribute an array in php is invalid? (e.g. name="foo[]" is invalid). For that matter, wouldn't that make fragments invalid? (e.g. <a name="#foo">) Quote Link to comment Share on other sites More sharing options...
AmandaF Posted April 7, 2009 Author Share Posted April 7, 2009 Did a bit more research and it looks like only ID attributes are limited the way I described. Name attributes can be any valid xhtml characters (so basically everything except < > and &). I'm going to mark this thread as solved, but if anyone has anything to add, please post a reply. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.