PDA

View Full Version : Select box params


tom123
03-06-2006, 09:04 PM
Ive got the javascript functions to add options from one select box to another.

//transfer all fields the user selects from the slected fields list to the available fields list
function add_to_available_list()
{
var i,field;

for(i=document.data.selected_fields.options.length-1; i>=0; i--)
{
field=document.data.selected_fields;
if(document.data.selected_fields[i].selected)
{
add_to_available(document.data.available_fields, document.data.selected_fields[i].value,document.data.selected_fields[i].value);
document.data.selected_fields.remove(i);
}
}
}

//Create the new option in the available fields list
function add_to_available(selectbox,text,value )
{
var option;

option = document.createElement("OPTION");
option.text = text;
option.value = value;
selectbox.options.add(option);
}

Problem is the following perl dosent seem to get any parameter values from the newly added options. is there something wrong with the way im adding options in the javscript function?

@selected_fields = param("selected_fields");
while(@selected_fields)
{
my %my_sel_fields;
$my_sel_fields{field} = shift @selected_fields;
push(@selected_fields_ref,\%my_sel_fields);
}
$session->param('selected_fieldss', \@selected_fields_ref);

<select name="selected_fields" class="selectBox" multiple="multiple" size="10">
<tmpl_loop name="selected_fieldss">
<option value="<tmpl_var field>"><tmpl_var field></option>
</tmpl_loop>
</select>

[CODE]

Is it possible to retreive all select box values using param, even if they are not selected?