hi
i have TWO combo Combo A and Combo B,
Combo A fetch data from database means dynamic values....
now i want that if user select Combo A and select prticular row or index and press ADD button than the selected value should add to Combo B...if user selecte ALL vaulues from Combo A and press ADD button than ALL Combo A values should copy to Combo B...., i am getting javascript error "object is null"
here is my code....
/************************************/
<?
require_once("class/connection.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script>
function a()
{
document.frmsizematrix.s2.remove(0);
}
function add(x)
{
//alert("Value of x is :" + x);
var boxLength;
var selectedItem;
var selectedText;
var selectedValue;
var i;
var thisitem;
var isNew = true;
if ( x == 0)
{
boxLength = document.frmsizematrix.s2.length;
selectedItem = document.frmsizematrix.s1.selectedIndex;
selectedText = document.frmsizematrix.s1.options[selectedItem].text;
selectedValue = document.frmsizematrix.s1.options[selectedItem].value;
}
if ( x == 1)
{
boxLength = document.frmsizematrix.s2.length;
selectedText = document.frmsizematrix.t1.value;
}
//var newoption;
//document.frmsizematrix.t1.value = x;//boxLength;
if (boxLength != 0)
{
for (i = 0; i < boxLength; i++)
{
if ( selectedText == document.frmsizematrix.s2.options.text)
{
isNew = false;
break;
}
}
}
if (isNew == true)
{
document.frmsizematrix.s2.options[boxLength] = new Option(selectedText,boxLength);
}
}
function rmv()
{
var selectedItem;
selectedItem = document.frmsizematrix.s2.selectedIndex;
document.frmsizematrix.s2.remove(selectedItem);
}
</script>
</head>
<body onload="a();">
<form name="frmsizematrix" method="post" action="SizeMatrixprocess.php">
<table width="69%" border="1" cellpadding="1" cellspacing="1" align="center" class="text">
<tr>
<td colspan="2" align="center"><b><font color="#0000FF">Add Width for Selected Item</font></b></td>
</tr>
<tr>
<td>Add Size Style Name :</td>
<td> <input type="text" name="txtSizematrix"></td>
</tr>
<tr>
<td width="25%"> Size</td>
<td width="75%"><table width="283" align="center">
<tr>
<td align="center">Available Sizes</td>
<td></td>
<td align="center">Assign Sizes</td>
</tr>
<tr>
<td><?
$sql="select * from tblsizemst";
$rs = mysql_query($sql);
$num = mysql_num_rows($rs);
//echo $sql;
//echo $num;
//$i=0;
?>
<select name="s1[]" size="6" multiple id="select" >
<?
while($row = mysql_fetch_array($rs))
{
$sizeId=$row[0];
$SizeName=$row[1];
echo"<option value=$SizeName>$SizeName</option>";
}
?>
</select> </td>
<td align="center"><input type="button" value="ADD" name="b1" onClick="add(0);">
<br>
<br>
<input type="button" value="Remove" name="b3" onclick="rmv();" /></td>
<td>
<select name="s2" size="6" multiple="multiple">
<option ></option>
</select> </td>
</tr>
<tr> </tr>
</table></td>
</tr>
<?
//}
//End of if condition
?>
<tr>
<td colspan="2" align="center"><input type="submit" name="btnadd" value="Save Size">
<input type="button" value="Cancel" onclick="window.close();" name="button">
</td>
</tr>
</table>
</form>
</body>
</html>