Results 1 to 8 of 8

Thread: [RESOLVED] html vs xhtml and using readonly

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Resolved [RESOLVED] html vs xhtml and using readonly

    So - I've got input boxes that I make readonly like this

    <input readonly type="text" class="awc-Refunds acs-edit-medium-text"/>

    Been using these for a few months with no issues.

    I just noticed that it's telling me in the IDE:

    Validation (XHTML 1.0 Transitional): This attribute name must be followed by an equal (=) sign and a value. If the value is in quotation marks, the quotation marks must match.
    Looking around the web I see that XHTML requires this to be

    <input readonly="readonly" type="text" class="awc-Refunds acs-edit-medium-text"/>

    Any problems with me changing this to the proper XHTML format.

    I looked into the difference between HTML and XHTML - seems it's just evolving standards.

    Is that all there is to it? Am I going to get burned by changing this??

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: html vs xhtml and using readonly

    Assuming you've set your doctype to XHTML, then setting it to readonly="readonly" is what should be done. At this point, the browsers are looking at your doctype, seeing only "readonly" and then checking other doctypes to see what to do with it.

    Both would most likely work in all browsers and not cause any issues, but if you're using XHTML, readonly="readonly" is the correct form.

    You'll also run into this scenario with checkboxes and radio buttons. For a checkbox, to make it checked by default, you can add "checked" to the element, but it should actually be 'checked="checked"', and radio button should be 'selected="selected"'.

  3. #3

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: html vs xhtml and using readonly

    I was sloppy too often - and didn't realize when looking up syntax online that HTML and XHTML are differing in these regards.

    I'm going to clean all this up to use the XHTML format.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: html vs xhtml and using readonly

    HTML5 allows three different specifications for some attributes. All three are equivalent:

    HTML Code:
    1. <input readonly type="text" class="awc-Refunds acs-edit-medium-text"/>
    2. <input readonly="" type="text" class="awc-Refunds acs-edit-medium-text"/>
    3. <input readonly="readonly" type="text" class="awc-Refunds acs-edit-medium-text"/>

    http://www.w3.org/TR/html-markup/inp...attrs.readonly

    In short, if you are using HTML5, you can safely ignore some of these IDE warnings.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  5. #5

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: html vs xhtml and using readonly

    If I use HTML5 - what does that mean different for one of my users?

    Do they all of a sudden need a new version of a browser to access my page???

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  6. #6
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,531

    Re: html vs xhtml and using readonly

    If I remember right, the X in XHTML was for "XML" ... which is a lot more picky about it's layout than HTML is.... XML doesn't allow for a value-less attribute, which is why you're getting the validation error.
    Seeing as how <input readonly="readonly" is already supported by XHTML and seems to be supported by HTML (which I suspect doesn't care what the value is)... that's what I'd go with...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: html vs xhtml and using readonly

    Quote Originally Posted by szlamany View Post
    If I use HTML5 - what does that mean different for one of my users?

    Do they all of a sudden need a new version of a browser to access my page???
    Using HTML5 is basically just changing your doctype to:
    Code:
    <!doctype html>
    Most of the new web-browser features are part of the HTML5 spec: Canvas, <video>, drag/drop, geolocation, web storage, file api, etc.

    Just change your doctype, and start using them! Or feature-detect with Modernizr and use polyfills for older browsers.

    Useful links: http://www.html5rocks.com/ http://html5boilerplate.com/ http://html5demos.com/ http://diveintohtml5.info/ http://caniuse.com/ http://html5please.com/ http://css3please.com/ http://mothereffinganimatedgif.com/ http://mothereffinghsl.com/ http://mothereffingtextshadow.com/
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  8. #8
    Registered User
    Join Date
    Apr 2013
    Posts
    3

    Re: html vs xhtml and using readonly

    An accurate professional website design has involvement of all above elements. Most of the web designers have to be capable of offering efficient technical and graphical web designs to the web sites and making the web design effective and efficient the web master should provide and use some techniques and tips for it.

Posting Permissions

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



Click Here to Expand Forum to Full Width