Open artlantis opened 11 years ago
Fix
function form_dropdown($data, $options=array(), $selected=array(), $label='', $extra='', $tooltip = '', $req= false,)
...
$required = ($req == true ? 'required' : '');
$output = <<<EOL
<div class="control-group {$error}">
<label class="control-label {$required}" for="{$data['id']}">{$label}</label>
<div class="controls">
<select {$output} {$extra}>
{$options_vals}
</select>
{$tooltip}
</div>
</div>
EOL;
The required attribute is not valid on the label element, it belongs on the select element, which means you could pass it in as part of $extra
.
Additionally, if you were to add another argument to form_dropdown(), you would likely want to leave the order of the existing arguments intact, so you would add it to the end of the argument list. I'm guessing the fourth argument in CI's form_dropdown function wasn't in place when Bonfire's form_dropdown function was written, but I could be wrong.
You are right Mat, changed the order. I did a mistake, I meant label required.
If I am not mistaken, bonfire has modified form_dropdown function. When I am checking the function, I saw that it takes 6 parameter. In normal way, the required option available in "label" option, therefore fourth parameter should take this option. But at the end of the function, just parsing $label paremeter as it is. Please check!