select all options in select listbox by default -- javascript
<p>I have a form which has a select list associated with the field <code>players</code>.</p>

<p>To populate the listbox, user clicks on a button on the form to display a popup and from that popup select players' names and then click another button on the popup which closes the popup and displays the selected values in the listbox.</p>

<p>By default, i put <code>selected="true"</code> in the select tag so that when user saves the form, the values in the listbox are saved. </p>

<pre><code>&lt;select size=5 id="sub_player_ids" name="sub[player_ids][]"  multiple selected="true"&gt;
</code></pre>

<p>The above code selects all options in the selectbox and those options are highlighted in blue.</p>

<p>However it can happen that user deselects an option in the player's select box by error.</p>

<p>I would like all options in the select box to be selected by default - whether they are highlighted or not </p>

<p>Is there is a way to select all options in the select box by default when saving the form?</p>

<p>Thanks a lot for any suggestion provided.</p>

<p>Cheers</p>
