N
news.wanadoo.nl
Hi,
I have found whit google this form in this group. But i'n not good in
javascript . I try and error normal but i only error now
Whit i now want to now how can i get access to the vars vis and inv. Normal
when i submit a form then is see something link
formhandler?vis=somthing&inv=something. But i dont see that in this form.
I want the use data form this form to set it in a databse whit php. I cant
get use nog $_GET['vis'] is wil give nothing.
Is there someone who can helpen me ?
The script:
<SCRIPT LANGUAGE="JavaScript"> // Code to move the seletions
function moveSelected(from, to) {
var fl = from.length;
var tl = to.length;
var i;
var n;
var newOpt;
// if there is a blank set <option></option>, get rid of it
if(tl == 1 && to.options[0].text == "") {
to.options[0] = null;
document.recalc(true);
tl--;
}
var index = 0;
for(i = 0; i < fl; i++) {
if(from.options.selected == true) {
newOpt = new Option(from.options.text, from.options.text,
false,
false);
index = findIndex(newOpt, to);
to.options.add(newOpt);
for(n = tl; n > index; n--) {
to.options[n].text = to.options[n - 1].text;
}
tl++;
to.options[index].text = newOpt.text;
from.options[i--] = null;
document.recalc(true);
fl--;
}
}
return;
}
function findIndex(insert, toList) {
var k;
for(k = 0; k < toList.length; k++) {
if( sorted(insert, toList.options[k]) == false) {
break;
}
}
if(k < 0) {
k = 0;
}
return k;
}
/* NOTE: This function will select all options in a select box.
This is
is often needed in conjunction with the moveSelected function.
Moving
an option into a "selected" box won't send it along when the form
is
submitted unless that box has all options selected.
*/
function doSelects(formElement) {
var i;
for(i = 0; i < formElement.length; i++) {
formElement.options.selected = true;
}
return;
}
function sorted(one, two) {
var oneString = one.text;
var twoString = two.text;
if(oneString > twoString) {
return true;
}
else {
return false;
}
}
</SCRIPT>
<form action=test.php method="get">
<table align=center width=400 style="font-family:arial; font-size:9pt;
colorurple;">
<tr>
<td>
<ul>
<li>Use the buttons below to add and remove
suppliers
<li>Hold down shift and use the mouse to select
multiple supliers
<li>Submit changes by clicking 'Update Database'
</ul>
</td>
</tr>
</table>
<p align="center"></p>
<table border=2 bordercolor=purple align=center><tr><td align=center>
<table align=center border=0 bgcolor=#f5f5f5 cellspacing=8
cellpadding=8>
<tr>
<td align=center style="font-family:arial; font-size:9pt;
colorurple;">Unavailable Suppliers</td>
<td width=50 align=center> </td>
<td align=center style="font-family:arial; font-size:9pt;
colorurple;">Available Suppliers</td>
</tr>
<tr>
<td align=center>
<select multiple style="width:150; colorurple;
background:#f5f5f5;"
size=10 id="inv" name="inv">
<option value=1>Supplier 1</option>
<option value=2>Supplier 2</option>
<option value=3>Supplier 3</option>
<option value=4>Supplier 4</option>
<option value=5>Supplier 5</option>
</select></td>
<td align=center> <!-- ################ BUTTONS ############## -->
<table align=center width=100% height=100% border=0 cellspacing=4
cellpadding=4>
<tr>
<td align=center>
<input onClick="moveSelected(inv,vis)"
title="Make selected
suppliers available" type="button" style="BACKGROUND-COLOR: #660066;
COLOR: #ffcc00; width:50;" name="add_to_inv" value=" > "><BR>
<input onClick="doSelects(inv);moveSelected(inv, vis) "
title="Make all suppliers available" type="button"
style="BACKGROUND-COLOR: #660066; COLOR: #ffcc00; width:50;"
name="add_to_vis" value=" >> "><BR>
</td>
</tr>
<tr>
<td align=center>
<input onClick="moveSelected(vis, inv)"
title="Make selected
suppliers unavailable" type="button" style="BACKGROUND-COLOR: #660066;
COLOR: #ffcc00; width:50;" name="add_to_vis" value=" < "><BR>
<input
onClick="doSelects(vis,inv);moveSelected(vis, inv)"
title="Make all suppliers unavailable" type="button"
style="BACKGROUND-COLOR: #660066; COLOR: #ffcc00; width:50;"
name="add_to_inv" value=" << "><BR>
</td>
</tr>
</table>
<td align=center>
<select multiple style="width:150; colorurple;
background:#f5f5f5;"
size=10 id="vis" name="vis">
<option value=6>Supplier 6</option>
<option value=7>Supplier 7</option>
<option value=8>Supplier 8</option>
<option value=9>Supplier 9</option>
<option value=10>Supplier 10</option>
</select>
</tr>
<tr>
<td align=center colspan=3><input type=submit name=submit
value="Update Database" style="BACKGROUND-COLOR: #660066; COLOR:
#ffcc00; width:200;"></td>
</tr>
</table></tr></td></table><form>
Greets Wouter
I have found whit google this form in this group. But i'n not good in
javascript . I try and error normal but i only error now
Whit i now want to now how can i get access to the vars vis and inv. Normal
when i submit a form then is see something link
formhandler?vis=somthing&inv=something. But i dont see that in this form.
I want the use data form this form to set it in a databse whit php. I cant
get use nog $_GET['vis'] is wil give nothing.
Is there someone who can helpen me ?
The script:
<SCRIPT LANGUAGE="JavaScript"> // Code to move the seletions
function moveSelected(from, to) {
var fl = from.length;
var tl = to.length;
var i;
var n;
var newOpt;
// if there is a blank set <option></option>, get rid of it
if(tl == 1 && to.options[0].text == "") {
to.options[0] = null;
document.recalc(true);
tl--;
}
var index = 0;
for(i = 0; i < fl; i++) {
if(from.options.selected == true) {
newOpt = new Option(from.options.text, from.options.text,
false,
false);
index = findIndex(newOpt, to);
to.options.add(newOpt);
for(n = tl; n > index; n--) {
to.options[n].text = to.options[n - 1].text;
}
tl++;
to.options[index].text = newOpt.text;
from.options[i--] = null;
document.recalc(true);
fl--;
}
}
return;
}
function findIndex(insert, toList) {
var k;
for(k = 0; k < toList.length; k++) {
if( sorted(insert, toList.options[k]) == false) {
break;
}
}
if(k < 0) {
k = 0;
}
return k;
}
/* NOTE: This function will select all options in a select box.
This is
is often needed in conjunction with the moveSelected function.
Moving
an option into a "selected" box won't send it along when the form
is
submitted unless that box has all options selected.
*/
function doSelects(formElement) {
var i;
for(i = 0; i < formElement.length; i++) {
formElement.options.selected = true;
}
return;
}
function sorted(one, two) {
var oneString = one.text;
var twoString = two.text;
if(oneString > twoString) {
return true;
}
else {
return false;
}
}
</SCRIPT>
<form action=test.php method="get">
<table align=center width=400 style="font-family:arial; font-size:9pt;
colorurple;">
<tr>
<td>
<ul>
<li>Use the buttons below to add and remove
suppliers
<li>Hold down shift and use the mouse to select
multiple supliers
<li>Submit changes by clicking 'Update Database'
</ul>
</td>
</tr>
</table>
<p align="center"></p>
<table border=2 bordercolor=purple align=center><tr><td align=center>
<table align=center border=0 bgcolor=#f5f5f5 cellspacing=8
cellpadding=8>
<tr>
<td align=center style="font-family:arial; font-size:9pt;
colorurple;">Unavailable Suppliers</td>
<td width=50 align=center> </td>
<td align=center style="font-family:arial; font-size:9pt;
colorurple;">Available Suppliers</td>
</tr>
<tr>
<td align=center>
<select multiple style="width:150; colorurple;
background:#f5f5f5;"
size=10 id="inv" name="inv">
<option value=1>Supplier 1</option>
<option value=2>Supplier 2</option>
<option value=3>Supplier 3</option>
<option value=4>Supplier 4</option>
<option value=5>Supplier 5</option>
</select></td>
<td align=center> <!-- ################ BUTTONS ############## -->
<table align=center width=100% height=100% border=0 cellspacing=4
cellpadding=4>
<tr>
<td align=center>
<input onClick="moveSelected(inv,vis)"
title="Make selected
suppliers available" type="button" style="BACKGROUND-COLOR: #660066;
COLOR: #ffcc00; width:50;" name="add_to_inv" value=" > "><BR>
<input onClick="doSelects(inv);moveSelected(inv, vis) "
title="Make all suppliers available" type="button"
style="BACKGROUND-COLOR: #660066; COLOR: #ffcc00; width:50;"
name="add_to_vis" value=" >> "><BR>
</td>
</tr>
<tr>
<td align=center>
<input onClick="moveSelected(vis, inv)"
title="Make selected
suppliers unavailable" type="button" style="BACKGROUND-COLOR: #660066;
COLOR: #ffcc00; width:50;" name="add_to_vis" value=" < "><BR>
<input
onClick="doSelects(vis,inv);moveSelected(vis, inv)"
title="Make all suppliers unavailable" type="button"
style="BACKGROUND-COLOR: #660066; COLOR: #ffcc00; width:50;"
name="add_to_inv" value=" << "><BR>
</td>
</tr>
</table>
<td align=center>
<select multiple style="width:150; colorurple;
background:#f5f5f5;"
size=10 id="vis" name="vis">
<option value=6>Supplier 6</option>
<option value=7>Supplier 7</option>
<option value=8>Supplier 8</option>
<option value=9>Supplier 9</option>
<option value=10>Supplier 10</option>
</select>
</tr>
<tr>
<td align=center colspan=3><input type=submit name=submit
value="Update Database" style="BACKGROUND-COLOR: #660066; COLOR:
#ffcc00; width:200;"></td>
</tr>
</table></tr></td></table><form>
Greets Wouter