e107 icon indicating copy to clipboard operation
e107 copied to clipboard

problem with options for $frm->select()

Open Jimmi08 opened this issue 4 years ago • 2 comments

Bug Description

If you want options for your select form, f.e. array( 'required'=> 1 , 'data-live-search'=>'true', 'class'=>'custom-class' ), those options are used not only for select tag, but for option tags too.

image

Jimmi08 avatar Apr 18 '21 12:04 Jimmi08

I found example from admin area too: (admin UI works correctly)

$text .= $frm->select('deprecatedLansReverse', $depOptions, e107::getParser()->filter($_POST['deprecatedLansReverse']), 'class=select form-control') . " ";

image

Is this correct? The same classes for option tag as for select tag?

Jimmi08 avatar May 11 '21 11:05 Jimmi08

The same classes for option tag as for select tag?

Don't know. @CaMer0n is this intentional?

Test code:

require_once("class2.php");

$campaigns = array(
	"0" => "test1",
	"1" => "test2"
);

$options 				= array();
$options['class'] 		= "select form-control"; 

echo e107::getForm()->select('campaign', $campaigns, '', $options)

Returns:

<select name='campaign' id='campaign' class='select form-control'>
<option value='test1' class='select form-control'>test1</option>
<option value='test2' class='select form-control'>test2</option>

</select>

Moc avatar Sep 06 '21 18:09 Moc