Welcome Guest, Not a member yet? Register   Sign In
set_select() makes all options selected, ignores third parameter
#1

[eluser]wdm*[/eluser]
This is how I'm using it in my form:

Code:
<select name="origin" id="origin" class="has-other-option required">
    <option value="">-</option>
    &lt;? foreach ($origin as $key => $value) : ?&gt;
        <option value="&lt;?= $key ?&gt;" &lt;?= set_select('origin', $key, FALSE) ?&gt; >&lt;?= $value ?&gt;</option>
    &lt;? endforeach; ?&gt;
    <option value="-1">Other</option>
</select>

And this is the html output:

Code:
<select id="origin" class="has-other-option" name="origin">
    <option value="">-</option>
    <option selected="selected" value="1">ORF</option>
    <option selected="selected" value="2">AE PrixArchiv</option>
    <option selected="selected" value="3">AE Festivalbüro</option>
    <option selected="selected" value="5">Rathaus</option>
    <option selected="selected" value="4">AE FutureLab</option>
    <option value="-1">Other</option>
</select>

The docs say:

Quote:The first parameter must contain the name of the select menu, the second parameter must contain the value of each item, and the third (optional) parameter lets you set an item as the default (use boolean TRUE/FALSE).

Looking at the Validation class, it seems not to take a third parameter?

Code:
function set_select($field = '', $value = '')

Is this a bug, or am I doing something wrong?


Messages In This Thread
set_select() makes all options selected, ignores third parameter - by El Forum - 10-24-2008, 06:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB