SitePoint Sponsor

User Tag List

Results 1 to 25 of 25

Thread: Checkbox Blues

  1. #1
    SitePoint Addict fesh's Avatar
    Join Date
    Jan 2005
    Location
    Jackson, New Jersey
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DTD with HTML validators (formerly: Checkbox Blues)

    HTML Code:
    <form name="boom" action="process.php" method="POST">
    	&nbsp;<b>Name:</b><br />
    	&nbsp;<input type="text" name="user" class="text" /><br /><br />
    					
    	&nbsp;<b>Password:</b><br />
    	&nbsp;<input type="password" name="pass" class="text" /><br /><br />
    
    	<input type="hidden" name="login_sub" value="1" />
    	&nbsp;<input type="checkbox" name="hi" /> Remember Me<br />
    	&nbsp;<input type="submit" value="Log In" class="button" /><br />
    </form>
    With that form the checkbox value isn't registering. Any thoughts?
    Last edited by fesh; May 23, 2005 at 15:22. Reason: Subject changed
    Fesh
    imagine what it's going to be like

  2. #2
    SitePoint Zealot metho's Avatar
    Join Date
    Feb 2005
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <input name="hi" type="checkbox" value="checked_value" />

    not

    <input type="checkbox" name="hi" />

  3. #3
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    UK, London
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And...
    HTML Code:
    <p><label for="user">Name</label></p>
    <p><input type="text" name="user" id="user" /></p>
    Instead of

    HTML Code:
    &nbsp;<b>Name:</b><br />
    	&nbsp;<input type="text" name="user" class="text" /><br /><br />
    Stop painting with HTML... It is 2005!
    Chris Heilmann
    Blog | Articles | Binaries

  4. #4
    SitePoint Addict
    Join Date
    Nov 2003
    Location
    Malmoe, Sweden
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by metho
    <input name="hi" type="checkbox" value="checked_value" />

    not

    <input type="checkbox" name="hi" />
    Actually itīs not necessary to give checkboxes and/or radios a value. They will send 'on' to the server if they are checked.

  5. #5
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    andrin, which browsers did you test that in?

    Some browsers may do that, however, since that is not part of the (X)HTML Specifications and the value attribute is required for checkboxes and radio buttons, browsers are not required to do that.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  6. #6
    SitePoint Addict
    Join Date
    Nov 2003
    Location
    Malmoe, Sweden
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ooops... My misstake here. Itīs actually the other way around, ot at least thatīs how I interpret the sentence at:

    http://www.w3.org/TR/html4/interact/...ef-value-INPUT

    If itīs not optional it has to be required I think. But the W3C validator has never complained on any page I have ever written. How do you guys interpret this?

    The fact that if I use functions like PHPs isset and $_POST['MYCheckbox'] it will return TRUE and 'on' if no 'value'-attribute has been added. This is true in most of the browsers I use regulary (Gecko-based and IE). I must confess that I have not done this test in Opera.

  7. #7
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As the HTML spec says, value not optional for type="checkbox" and type="radio". The reason the validator isn't complaining is that this sort of syntactic requirement cannot be expressed in a DTD. Since value is not required for all type attribute values, it must be #IMPLIED in the DTD.

    Quote Originally Posted by codepoet
    Stop painting with HTML... It is 2005!
    Birnam wood is come to Dunsinane

  8. #8
    SitePoint Addict
    Join Date
    Nov 2003
    Location
    Malmoe, Sweden
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I always thought that the validator was a little more clever then simple DTD validation. Like an extended DTD-validator that could make such 'advanced' tasks ;-) But itīs clear that I was wrong. You actually need to know the (X)HTML by heart to do the right thing.

  9. #9
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    UK, London
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by andrin
    I always thought that the validator was a little more clever then simple DTD validation. Like an extended DTD-validator that could make such 'advanced' tasks ;-) But itīs clear that I was wrong. You actually need to know the (X)HTML by heart to do the right thing.
    Or you look it up if you are not sure. That's what the w3c web site is for.
    Technical tools like automated testing only get us so far, our own brain helps further.
    Chris Heilmann
    Blog | Articles | Binaries

  10. #10
    SitePoint Addict
    Join Date
    Nov 2003
    Location
    Malmoe, Sweden
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Of course. But is it too much to ask for that the validator actually 'validate' the document. Not validate as in SGML/XML/DTD-validate but 'validate' as in 'is the syntax in this document valid/correct/whatever'. Donīt get me wrong here but as a web standards evangelist I must say that if proffesionals have problem (as I seem to have). How will we ever convice the majority? If the validation service isnīt good enough. Is this not a bug?

    Tell a dreamweaver addict that the code isnīt valid even if the validator says it is. That he/she must read tech manuals and references?!? That would really be the 'blow-of-death' to web standards. We must consider that most ppl have better things in life to do then reading W3C-specifications down the last letter :-) I know I start to get better things to do nowadays anyway ;-)

  11. #11
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    UK, London
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The validator has always been buggy[1], and the w3c group developing it is doing one hell of a job.

    A validator is a tool, I can create perfectly valid HTML that doesn't make sense at all. Developing with web standards also includes using the right element for the right purpose, and that is something no validator can tell you.

    The blow of death for both web standards and accessibility is if we treat and sell it as a technical issue, it also involves understanding what you do.

    Vincent Flanders explained that nicely in the "Mystical belief in the power of Web Standards, Usability, and tableless CSS." section of "The Biggest Web Design Mistakes of 2004".[2]


    [1] http://old.alistapart.com/stories/betterliving/
    [2] http://www.webpagesthatsuck.com/bigg...s-in-2004.html
    Chris Heilmann
    Blog | Articles | Binaries

  12. #12
    SitePoint Addict
    Join Date
    Nov 2003
    Location
    Malmoe, Sweden
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by codepoet
    The validator has always been buggy[1], and the w3c group developing it is doing one hell of a job.
    They are indeed :-) And they have been ahead of us for the last 10 years. Now when the market is catching up it will expect more and if W3C canīt give it then we will have another company (no names) thinking they can outrun the world by doing things their own way.

    Makes me think of one thing. Look to it as a joke. I know the boys and girls over at W3C is working their butts of for a better cause but I must say Iīm concearned about this fact that the validator doesnīt find a pretty easy thing. What can it be? 4 lines of code? If type is checkbox or radio then value is required?!?
    Quote Originally Posted by codepoet
    A validator is a tool, I can create perfectly valid HTML that doesn't make sense at all. Developing with web standards also includes using the right element for the right purpose, and that is something no validator can tell you.
    So can everyone and fact is most laymen do :-))) And if I was to decide there would be no laymen writing (X)HTML. Leave things to ppl who knows what to do, when to so and how to do. Still there will be a lot of ppl in companies who will think (X)HTML is 'easy' (well it IS easy but... You know what I mean, or?) and that they can do as they please. I say STOP! Leave it to proffesionals untill someone develops a WYSIWYG-editor that outputs correct and valid markup.
    Quote Originally Posted by codepoet
    The blow of death for both web standards and accessibility is if we treat and sell it as a technical issue, it also involves understanding what you do.

    Vincent Flanders explained that nicely in the "Mystical belief in the power of Web Standards, Usability, and tableless CSS." section of "The Biggest Web Design Mistakes of 2004".[2]
    Yes, Iīve read both of them and they are briliant but lets face it. We are not as many and none of us (we who like web standards) have time to explain the importance of using webstandards and how they should use them to laymen. Thatīs what makes the validation service so important. We can tell a thousand people at the same time how and where they should validate their documents but we donīt (I donīt) have the time to sit down with each one and for eight hours convince/tell/teach (Ok. Face it. Itīs all about convincing) why and how.

  13. #13
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think there's some sort of misunderstanding here. A validator will check that the document is valid, i.e. that it conforms to the syntactic rules specified by a DTD (or XML Schema, in theory).

    It is syntactically valid to omit the value attribute of an INPUT element. Even for a checkbox or radio button. It is semantically incorrect, but that's nothing the validator is concerned with.

    It might be a simple hack, as you say, if the validator used hard-coded rules. That would mean that the validator would have to be rewritten as soon as there was a new version – even a bugfix – of a markup standard.

    A validator that checks the markup against a DTD, however, can be used to validate any SGML/HTML/XML document.
    Birnam wood is come to Dunsinane

  14. #14
    SitePoint Addict
    Join Date
    Nov 2003
    Location
    Malmoe, Sweden
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe a checkbox with 'Check if semantically correct aswell?' :-)

    If you build it module based with a plug-in architecture it would be a snap to extend it when new versions arrived.

    10 Validate against DTD
    20 Validate it semantically

    *lol*

    Now let us get down to business. How do you propose it would be solved? Give me a concreate solution that I could use to tell my fellow developers (who are not as fond of web standards as I am). What arguments will I use? "Yes it validates but itīs still not right you see...".

  15. #15
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Validate this document and think again.
    Simon Pieters

  16. #16
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by andrin
    If you build it module based with a plug-in architecture it would be a snap to extend it when new versions arrived.
    I doubt that. Maybe with a well thought-through object-oriented design, you'd be able to extend existing functionality, but it would be very iffy.

    I don't know what background your fellow developers have, but if they're programmers, compare it to this:
    Code:
    int main()
    {
      int  a = 1;
      int  b = 0;
    
      printf("%d\n", divide(a, b));
      return 0;
    }
    
    int  divide(int a, int b)
    {
      return a / b;
    }
    That will pass straight through a C parser (i.e. it's valid), but it won't work very well.

    You can't expect automated tools to fix everything for you. You'll still have to make an effort if you want to be a professional, even in web design.
    Birnam wood is come to Dunsinane

  17. #17
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by andrin
    I know the boys and girls over at W3C is working their butts of for a better cause but I must say Iīm concearned about this fact that the validator doesnīt find a pretty easy thing. What can it be? 4 lines of code? If type is checkbox or radio then value is required?!?
    I'm not sure how the validator checks for things like the alt attribute for <img> elements, but I still doubt it would only be 4 lines of additional code.

    It seems that you've never written a parser script.

    Out of curiosity, which programming, scripting, and markup languages do you know?
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  18. #18
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    UK, London
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Furthermore it would be rather stupid to simulate the rules of validity in the code rather than just using and parsing the DTD.
    Chris Heilmann
    Blog | Articles | Binaries

  19. #19
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wouldn't it be possible to check according to the DTD and then add a supplemental check for things the can't be expressed in the DTD?
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  20. #20
    SitePoint Addict
    Join Date
    Nov 2003
    Location
    Malmoe, Sweden
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kravvitz
    Wouldn't it be possible to check according to the DTD and then add a supplemental check for things the can't be expressed in the DTD?
    Hmm... As far as I see it was exactly what I said in:
    Quote Originally Posted by andrin
    Maybe a checkbox with 'Check if semantically correct aswell?' :-)

    If you build it module based with a plug-in architecture it would be a snap to extend it when new versions arrived.
    But itīs true. As you get error messages that your ID and/or name attributes contains illegal characters there must be more then just plain ol' DTD-validation as this kind of check is out of scope for DTD syntax validation.
    Quote Originally Posted by codepoet
    Furthermore it would be rather stupid to simulate the rules of validity in the code rather than just using and parsing the DTD.
    True... True. Of course itīs never a good idea hard code these type of things. When do you think XML Schemas will supersede DTDs in this context? You could do the validation against an extended XML Schema that origins from the DTD. DTD-2-Schema converters there are plenty of.
    Quote Originally Posted by AutisticCuckoo
    You can't expect automated tools to fix everything for you. You'll still have to make an effort if you want to be a professional, even in web design.
    Hell no :-) But it seems that you all guys have the best of jobs where your bosses and server side developer colleagues leave the things you do best to you and donīt interfere casue 'HTML is so easy and I have read a book called "HTML for dummies" and itīs not important that it work as long as it works in IE yadda yadda...". Well! Can you spot my frustration? The only defence I have is to tell them: "The guys that invents web standards have this validation tool and as long as your pages donīt validate I canīt let them through. We need QA!" How do I tell them: "Yes it validates but itīs still f*cked up..." ?!?!?!?!? How? Without telling them that they need to spend the coming year ahead to learning (X)HTML?

  21. #21
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by andrin
    As you get error messages that your ID and/or name attributes contains illegal characters there must be more then just plain ol' DTD-validation as this kind of check is out of scope for DTD syntax validation.
    Nope. The 'id' attribute is defined to be of type ID, for which the legal character repertoire is clearly defined.

    Quote Originally Posted by andrin
    But it seems that you all guys have the best of jobs where your bosses and server side developer colleagues leave the things you do best to you and donīt interfere
    You need to keep your boss in check and not let them interfere with things they don't understand.

    Quote Originally Posted by andrin
    Can you spot my frustration?
    Yes, I share it too. Lots of people still believe that web design and development is child's play because of cr*p like Frontpage and Dreamweaver. They don't understand why it's better to mark up a paragraph with <p>...</p> than with <br><br>, since it "looks the same anyway."

    Quote Originally Posted by andrin
    How do I tell them: "Yes it validates but itīs still f*cked up..." ?!?!?!?!? How? Without telling them that they need to spend the coming year ahead to learning (X)HTML?
    Would they expect to be proficient in any other job without learning anything?
    Birnam wood is come to Dunsinane

  22. #22
    SitePoint Addict
    Join Date
    Nov 2003
    Location
    Malmoe, Sweden
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo
    Nope. The 'id' attribute is defined to be of type ID, for which the legal character repertoire is clearly defined.
    I now itīs 'defined' to be of type ID but I does not seem to find the 'definition'. Could you please be so kind to point out where I can find it. I found this: http://www.w3.org/TR/html4/types.html#type-id but thatīs only the description of the definition not the definition itself. I searched:

    http://www.w3.org/TR/html4/strict.dtd
    http://www.w3.org/TR/html4/loose.dtd
    http://www.w3.org/TR/html4/framset.dtd
    http://www.w3.org/TR/html4/HTMLlat1.ent
    http://www.w3.org/TR/html4/HTMLsymbol.ent
    http://www.w3.org/TR/html4/HTMLspecial.ent

    but all in vain.
    Quote Originally Posted by AutisticCuckoo
    Would they expect to be proficient in any other job without learning anything?
    They have no interest in learning 'the right way' of HTML. They are concerned about C++ and stuff like that. Iīm all for having a clear seperation of Front-End and Back-End but when the database architect decides to do 'quick' HTML hack himself and conside himself higher up in the value chain there is not much to do :-( This holds even true to the front-end developers that have been at the company longer than I and the boss sure listens to them more then to me. By the way. The boss is a typical manager. Donīt know anything about tech, not interested to learn... *sigh* When I think about it Iīm gonna quit my job as soon as possible :-P

  23. #23
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by andrin
    I now itīs 'defined' to be of type ID but I does not seem to find the 'definition'. Could you please be so kind to point out where I can find it.
    SGML basic types
    ID and NAME tokens must begin with a letter (&#91;A-Za-z&#93;) and may be followed by any number of letters, digits (&#91;0-9&#93;), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
    Quote Originally Posted by andrin
    They have no interest in learning 'the right way' of HTML. They are concerned about C++ and stuff like that.
    That sounds odd. C++ programmers usually understand the need for strictness and correctness, as well as the advantages of separating structure from presentation. Real C++ programmers, that is. :)
    Birnam wood is come to Dunsinane

  24. #24
    SitePoint Addict
    Join Date
    Nov 2003
    Location
    Malmoe, Sweden
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo
    This is not The Definition. Itīs the same description of the definition as I linked to. Iīm looking for the definition inside the DTD that the validator uses when it validates. Or is This hard-coded inside the SGML-parser? I suspect it must be considering that I can find nothing that even resembles a regex or string template inside the actual DTD.
    Quote Originally Posted by AutisticCuckoo
    That sounds odd. C++ programmers usually understand the need for strictness and correctness, as well as the advantages of separating structure from presentation. Real C++ programmers, that is.
    Hmm... I donīt think you find any real programmers at all here. Itīs almost drag-n-drop MS think here. We are leaving old 3-layer COM (C++)/ASP for C# .NET but it makes no difference. I have nagged about 2 years now about not designing with tables but that also in vain.

  25. #25
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the basic SGML types are hard-coded. You have to have axioms somewhere.

    The DTD cannot define which characters are valid inside an element or an attribute. That's one of the shortcomings that caused XML Schema to be invented. You have a fixed number of types to your disposal, and that's it.

    For instance, many attributes have their data type specified as %URL;, but that entity reference resolves to a simple CDATA. There is no way the validator can check that the value inside an 'href' attribute is a valid URL.
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •