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

Bug (minor) in the HTML_OPTIONS (pb of id and optgroup)

 
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 -> Plugins
View previous topic :: View next topic  
Author Message
Kleduts
Smarty n00b


Joined: 29 Mar 2011
Posts: 1

PostPosted: Tue Mar 29, 2011 10:01 am    Post subject: Bug (minor) in the HTML_OPTIONS (pb of id and optgroup) Reply with quote

Hi,

I think I have found a (minor) bug in the HTML_OPTIONS.

The problem is when you create select list with optgroup. The current code (3.0.7) generates ids with concatenation.
But if you don't define inital id, the generated id looks like "-3-4". And HTML validation don't appreciate this kind of id.

The solution is (line 117 in the function.html_options.php file) :
Code:
// $_html_result = smarty_function_html_options_optgroup($key, $value, $selected, $id.'-'.$idx, $class, $_idx);
$_html_result = smarty_function_html_options_optgroup($key, $value, $selected, (!empty($id) ? $id.'-'.$idx : ''), $class, $_idx);


Replace the $id.'-'.$idx by the test : (!empty($id) ? $id.'-'.$idx : '').

Regards

Fabrice
from Bordeaux - France
Back to top
View user's profile Send private message
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 -> Plugins 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