xHTML Validation fix for Radio Buttons

For my developed themes, specially reDesign. Please make different topic for every problem.
Vasta teemaleVasta teemale Printerisõbralik lehekülg
Foorumi KKKOtsiVaata vastamata teateid

xHTML Validation fix for Radio Buttons

Postitus Postitatud: 9.12.10. 11:53:27

The generated HTML fails w3 Validation with a duplicate ID error for every use of the radio button. The code is in theme_yesno_option in theme.php. Line 514 in CVS.

Kood:
    <input type="radio" name="'.$name.'" id="'.$name.'" value="0" '.$sel[0].' />

removing the 2nd id declaration (it is already defined on line 512) fixes.

Kood:
    <input type="radio" name="'.$name.'" value="0" '.$sel[0].' />


layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
L:U8.1/A:2.2.8/M:5.0.51a/P5.2.5/D:9.2.1

layingback
Tõusmas kõrgemale
Tõusmas kõrgemale
 

Re: xHTML Validation fix for Radio Buttons

Postitus Postitatud: 9.12.10. 16:27:44

And while I was at it...

In header.html
Kood:
  <form id="headsearch" class="special" action="{U_SEARCH}" method="post" enctype="multipart/form-data" accept-charset="utf-8">
    <a href="{U_SEARCH}">_(SearchLANG):</a>
    <em></em><input id="search_word" class="specialtext" type="text" name="search" size="20" maxlength="40" /><b></b>
    <tt></tt><button type="submit">_(SEARCH)</button><i></i>

becomes (adding non-breaking space to avoid empty element, 4 of):

Kood:
  <form id="headsearch" class="special" action="{U_SEARCH}" method="post" enctype="multipart/form-data" accept-charset="utf-8">
    <a href="{U_SEARCH}">_(SearchLANG):</a>
    <em>&nbsp;</em><input id="search_word" class="specialtext" type="text" name="search" size="20" maxlength="40" /><b>&nbsp;</b>
    <tt>&nbsp;</tt><button type="submit">_(SEARCH)</button><i>&nbsp;</i>

And now I have a theme which validates clean on a basic page, no errors, no warnings. Yeah!!! Useful! So that I can easily catch errors that I add when writing my own xHTML Silmapilgutus

I'm not using the very latest CVS. Will update shortly, and report back if I find anything else...

layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
L:U8.1/A:2.2.8/M:5.0.51a/P5.2.5/D:9.2.1

layingback
Tõusmas kõrgemale
Tõusmas kõrgemale
 

Re: xHTML Validation fix for Radio Buttons

Postitus Postitatud: 9.12.10. 20:04:55

Hmmm... On latest CSV version now, and bumped into the unselectable="on" issue - W3C Validation error.

The validation error is valid, as it is not defined in any DTD.

But this link indicates that an onselectstart trick works as well or better than unselectable as it is inherited by child elements.

But onselectstart also fails Validation with an Error!

But this link offers a javascript function as a solution to disabling onselectstart.

And I see that in reDesign/javascript/block.js you are already using getElementById on the element, so could you use the attachEvent to element in there instead of in the xHTML?

But I'm not sure if you'd want it on all cases, or just if toggled on or off? Plus it's hard to test IE-specific cases on Ubuntu! Naerev

TIA!

layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
L:U8.1/A:2.2.8/M:5.0.51a/P5.2.5/D:9.2.1

layingback
Tõusmas kõrgemale
Tõusmas kõrgemale
 

Re: xHTML Validation fix for Radio Buttons

Postitus Postitatud: 10.12.10. 20:33:13

I've used javascript solutions to disable selection (I disable the selection when there are links for toggling something, as usually double clicking (toggling quickly) causes text selection instead). Using unselectable doesn't cause any problems in browsers actually, so I've just ignored the standard.

I'm not sure, if there is any future for reDesign, so I don't think it'll be added anytime soon.


(Also, pri.ee domains will cost in 2011, so this site might go down - or 000.oh.ee might work, in case the free hoster I use atm, will remain).

Madis's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.0.63/5.0.67/5.2.5/9.2.1

Madis
Administraator
Administraator
 

Re: xHTML Validation fix for Radio Buttons

Postitus Postitatud: 11.12.10. 19:06:11

Thanks for the reply!

OK, now I understand the goal (fix double click), I think the code changes are just:

Add the attachEvent line to toggleBlockCollapsed in block.js:

Kood:
function toggleBlockCollapsed(blockID) {
	// block content element id
	var bpe = document.getElementById('pe'+blockID);
	document.getElementById('pe'+blockID).attachEvent('onselectstart', rfalse);

And append to block.js:

Kood:
function rfalse() { return false; }

And then remove the now unneeded unselectable="on" from header.html (1 of) and footer.html (3 of).

I'll put it up on a live site next week, so it can be tested with IE, and report back.

Thanks for your help, and do I hope you and your site hang around in '11!!! I really do! I believe reDesign _has_ a confirmed future in DF. (But that of course begs another question Silmapilgutus )

layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
L:U8.1/A:2.2.8/M:5.0.51a/P5.2.5/D:9.2.1

layingback
Tõusmas kõrgemale
Tõusmas kõrgemale
 

Re: xHTML Validation fix for Radio Buttons

Postitus Postitatud: 17.12.10. 21:43:10

Another vote for reDesign from me! It's the future for DF!

rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/5.0.91/5.2.8/9.2.1

rosbif
Tõusmas kõrgemale
Tõusmas kõrgemale
 
Lehekülg 1, lehekülgi kokku 1



Sa ei saa teha siia alafoorumisse uusi teemasid
Sa ei saa vastata siinsetele teemadele
Sa ei saa muuta oma postitusi
Sa ei saa kustutada oma postitusi
Sa ei saa hääletada küsitlustes
Sa ei saa lisada faile selles alafoorumis
Sa saad allalaadida faile selles alafoorumis