Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Featured Threads
  inspiration alert!!!
(36 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies) Members Gallery
(516 replies)
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

W3 validating xhtml custom attributes (guru question)
show user profile  mandelid
W3 validating xhtml custom attributes (guru question)

Scenario (hypothetical)
Lets say I have several divs on a webpage (admin page in content management solution). Lets say that each div represents a user/product/blogitem in my backend database. When I right-click the div I want to present a contextmenu with the option "edit xxx", "delete xxx" and so on.

I want to be able to use the following syntax <div userid="12">...&tt;/div>

This is not possible. W3 will not validate this because userid is not a known xhtml attribute of div.

My first attempt at solving this was adding a custom namespace to the html-element
<html xmlns="" xmlns:my="" lang="no" dir="ltr">
and then writing <div my:userid="12">...</div>

Still does not validate. My next idea was to create my own DTD and use that as the doctype, but the W3 validator does not like this... it only uses the DTDs it knows about, and does not go out and download custom DTDs (I haven't tried this myself, read it somewhere online).

Does this mean that custom attributes is a no-go when it comes to validating?

Wouldn't it be nice to be able to write <input type="text" required="true" errormessage="Firstname is required" /> etc.

I know this is frowned upon by web standard fundamentalists, but when it comes to web besed applications this feature would be very helpful, especially when communicating with server-side backends using ajax. The server can then leave info attached to the element (ProductID, BlogID, CommentID etc) that is easilly retrieved by javascript (jquery) and passed back to the server via some cool javascript/Ajax feature.

If I only want to mark the element for something, required for instance, I can just attach a class to it like <input type="text" class="required" value="test" />, but alot of times I want to add some parameters to the class, and then the key/value approach of attributes seems like the best solution. - - - - - - - - - - - - - - - - - thanks... Mandelid
read 2981 times
11/21/2008 2:48:40 PM (last edit: 11/21/2008 2:51:38 PM)
show user profile  Loud

read 2963 times
11/21/2008 4:55:21 PM (last edit: 11/21/2008 4:55:21 PM)
show user profile  mandelid
As I said, I have tried the inline method, and because it prints "]>" at the top of the page this is not a good solution for me.

When it comes to creating a custom DTD the W3 validator does not check against custom DTDs. It only uses its built in DTDs. In the article you (Loud) linked to it says:

"The solution is to use a different validator which will actually go out to the URL that you have specified and use it to check whether your document is valid or not."

This is not an option for me. In norway websites run by the government are testet once a year, and given a rating. This test uses the W3 validator to check the html kode is correct. I have no control over this.

I guess there is noe way to get this to validate even if you do it the correct way. Custom namespaces, inline DTD extensions and custom DTD all seems to work (and is a correct way of doing things)... but because of limitations in browsers and the W3 validator its just not an option for me.


Back to the drawing board... - - - - - - - - - - - - - - - - -
read 2947 times
11/22/2008 4:46:51 AM (last edit: 11/22/2008 4:49:08 AM)
show user profile  advance-software
The whole point of XML (eXtensible markup language) is to allow this kind of thing.

XML compliant browsers should just skip over elements and attributes they don't understand.

Problems could occur if the markup language you are using (in this case XHTML) extends to use one of the attributes or elements you are defining in a future upgrade. You can avoid this possible clash by using namespaces.

It is the validator that needs an upgrade, not your code.

Last resort : Email Tim
read 2942 times
11/22/2008 4:54:58 AM (last edit: 11/23/2008 8:09:18 AM)
#Maxforums IRC
Open chat window