Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

html_options can generate invalid X/HTML

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
deerwood
Smarty n00b


Joined: 25 Apr 2006
Posts: 1

PostPosted: Tue Apr 25, 2006 1:54 am    Post subject: html_options can generate invalid X/HTML Reply with quote

The docs for html_options (current version 2.6.13) read:

Quote:
If a given value is an array, it will treat it as an html <optgroup>, and display the groups. Recursion is supported with <optgroup>. All output is XHTML compatible.


While the first 2 sentences are right, the 3rd/last sentence isn't: X/HTML do NOT allow nested <optgroup> elements. Valid children of <optgroup> are only <option> elements.

Thus the docs should be changed at least and contain a big warning about that issue. The code might remain as is, because the W3C some day will allow for nesting and browsers might follow some years later.

Beeing paranoid one could attempt to catch the issue in the code too.

regards, Georg aka deerwood
Back to top
View user's profile Send private message Visit poster's website
cowboystyle
Smarty Rookie


Joined: 02 Oct 2006
Posts: 5
Location: New York, NY

PostPosted: Fri Dec 01, 2006 11:47 pm    Post subject: Reply with quote

html_options, current version is generating code which is NOT XHTML 1.0 Strict, see here:

This code...
{html_options options=$partners name=type selected=$type}

Is producing this xhtml node...
<select name="type" onChange="" >

Which the W3C doesn't like...

Quote:
<select name="type" onChange="" > there is no attribute "onChange".

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.


Anyone know what the deal is?
Back to top
View user's profile Send private message Visit poster's website AIM Address
TGKnIght
Smarty Junkie


Joined: 07 Sep 2005
Posts: 580
Location: Philadelphia, PA

PostPosted: Mon Dec 04, 2006 2:11 pm    Post subject: Reply with quote

I think it might not like capital letters

<select name="type" onchange="">
_________________
Smarty site with one index.php controller file
Working with MySQL and Smarty
SmartyColumnSort
Custom Smarty Javascript Debug Template
Back to top
View user's profile Send private message Visit poster's website
cowboystyle
Smarty Rookie


Joined: 02 Oct 2006
Posts: 5
Location: New York, NY

PostPosted: Mon Dec 04, 2006 4:15 pm    Post subject: Reply with quote

Yup, that's it... here's the "fix" (worked on my companies setup):

Go to: /smarty/templates/plugins directory
Open file: functions.html_options.php
Change line # 95, modify: onChange -> onchange

Weird, this may be my own configuration, I'd like to know if anyone else has the same problem.
Back to top
View user's profile Send private message Visit poster's website AIM Address
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Mon Dec 04, 2006 4:27 pm    Post subject: Reply with quote

cowboystyle wrote:
Yup, that's it... here's the "fix" (worked on my companies setup):

Go to: /smarty/templates/plugins directory
Open file: functions.html_options.php
Change line # 95, modify: onChange -> onchange

Weird, this may be my own configuration, I'd like to know if anyone else has the same problem.


That's not in the standard shipped Smarty version.
Back to top
View user's profile Send private message
TGKnIght
Smarty Junkie


Joined: 07 Sep 2005
Posts: 580
Location: Philadelphia, PA

PostPosted: Tue Dec 05, 2006 2:55 pm    Post subject: Reply with quote

Confirmed.. You have a modified version of function.html_options.php
_________________
Smarty site with one index.php controller file
Working with MySQL and Smarty
SmartyColumnSort
Custom Smarty Javascript Debug Template
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP