nrueckmann / smarty-php

Automatically exported from code.google.com/p/smarty-php
0 stars 0 forks source link

html_options support for disabled options #198

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
It looks like that it is not possible to disable single options in a select tag 
with html_options.
The disabled option only disables the whole select input for me, so i slightly 
changed the code.

This handles the disable attribute just like the selected attribute.

PHP-Code
$options = array(
             0 => "option0",
             1 => "option1",
             2 => "option2"
           );

$smarty->assign("options",$options);
$smarty->assign("disabled", array(1,2));

Smarty-Template
<select>
 {html_options options=$options disabled=$disabled strict=1}
</select>

HTML-Output
<select>
 <option value="0">option0</option>
 <option value="1" disabled>option1</option>
 <option value="2" disabled>option2</option>
</select>

My changes are in the disabled, readonly case of the switch-statement

Original issue reported on code.google.com by petekrem...@gmail.com on 26 Aug 2014 at 10:39

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago

Original comment by Uwe.Tews@googlemail.com on 18 Sep 2014 at 3:36