Hello,
I use a javascript that allows me to move a selection up or down in a list of selections. My problem is that I do not know how to get that info when I want to submit it.
Is there a way to set the submit button to select all selections so that the values will be passed?
Thanks!
Here is the code:
function reorderList($module)
{
global $script;
?>
</style>
<script type="text/javascript" language="javascript">
//courtesy M. Honnen /////////////
//http://www.faqts.com ///////////
function moveSelected (select, down)
{
if (select.selectedIndex != -1)
{
if (down)
{
if (select.selectedIndex != select.options.length - 1)
var x = select.selectedIndex + 1;
else
return;
}
else
{
if (select.selectedIndex != 0)
var x = select.selectedIndex - 1;
else
return;
}
var swapOption = new Object();
swapOption.text = select.options[select.selectedIndex].text;
swapOption.value = select.options[select.selectedIndex].value;
swapOption.selected = select.options[select.selectedIndex].selected;
swapOption.defaultSelected = select.options[select.selectedIndex].defaultSelected;
for (var property in swapOption)
select.options[select.selectedIndex][property] = select.options[x][property];
for (var property in swapOption)
select.options[x][property] = swapOption[property];
}
}
</script>
<form ACTION="<?php echo $script;?>" METHOD=POST onsubmit="return false;">
<table cellspacing="0" cellpadding="3" border="3">
<tr><td><?php
$x = count($module[routines]);
if($x < 5)
$x = 5;
?>
<select name="routine" size="<?php echo "$x"; ?>" style="width:180px;"><?php
$x = 0;
while($module[routines][$x])
{
?><option value="<?php echo "$x";?>"><?php
echo $module[routines]["$x"][name];
?></option><?php
$x++;
}
?></select>
<td align="center">
<INPUT TYPE=BUTTON VALUE="move up" onclick="moveSelected(routine,false)" /><br /><br />
<INPUT TYPE=BUTTON VALUE="move dn" onclick="moveSelected(routine,true)" /><br /><br />
</td></table>
<INPUT TYPE=SUBMIT NAME="rearrange" VALUE="Rearrange">
</form>
<?php
}