(1)
1)here i'm doing clone of a row...but this code is working only in eclipse [ ie ,cloning is working ] and it is also not working in anybrowsers.
if i write
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "Page on W3">
to this code ,it will not work in eclipse also.....
2)i have servlet code to get only single value from jsp
String address_seq_num=request.getParameter("address_seq_num");
String effdt =request.getParameter("effdt");
String eff_status =request.getParameter("eff_status");
how can i get the value of address seq number in the cloned row fromjsp to servlet to insert into the next row of a table in the database.
please guide me...
(2)
first image is showing cloning of rows
1)first address seq number wiil be 1, and user will enter effective date and effective status...
2)when user click [+] the next row will comes with auto increment of address seq num=2... and user will enter rest of the fields...
3)my problem is...how can i insert the subsequent "address seq number" , "effective date" and "effective status" to subsequent rows in the database table as i shown in the second image....
i dont know how to do...please guide me
{ <html> ![85fb79e28b64699e66143875693df335](/attachments/small/4/85fb79e28b64699e66143875693df335.PNG "align-left") ![5ad6953267e5e57d4b958ae4b67dd115](/attachments/small/4/5ad6953267e5e57d4b958ae4b67dd115.PNG "align-left")
<head>
<script>
function clonetable()
var x=document.getElementById("main_table"); //get the table
var rowCount = x.rows.length;
var row = document.getElementById("table_row_clone"); // find row to copy
var table = document.getElementById("table_body"); // find table to append to
var clone = row.cloneNode(true); // copy children too
//var tb = document.getElementById("asn");
//var rowCount = x.rows.length;
//var y=document.getElementById("maintable");
//var count=y.rows.length;
var tb1 = clone.document.getElementById("asn");
//tb1.value = parseInt(tb1.value, 10) + 1;
tb1.value=rowCount+1;
//tb1.value=count+1;
Page on Clone = "abc"; // change id or other attributes/contents
table.appendChild(clone); // add new row to end of table
}
function deltable()
{
var x=document.getElementById("main_table"); //get the table
var rowCount = x.rows.length;
if(rowCount>1)
{
x.deleteRow(rowCount-1);
}//delete the last row
}
</script>
</head>
<body>
<table id="main_table" align="center" style="width:75%" >
<tbody id="table_body">
<tr id="table_row_clone">
<td>
<table align="center" style="width:100%" >
<tr >
<td align="center">
<div style="border:3px solid silver;border-radius:5px;background-color:grey">
<table width="100%" >
<tr>
<th align="center" >
Address Details
</th>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td>
<div style="border:3px solid silver;border-radius:5px;background-color:#1E90FF">
<table align="center" style="width:99%">
<tr style="background-color:#1E90FF">
<td style="width:35%">
<table width="100%">
<tr id="slrow">
<td style="width:43%">
Address Seq Num
</td>
<td>
<input id="asn"style="width:60px" name="address_seq_num" type="text" value="1" readonly>
</td>
</tr>
</table>
</td>
<td width="49%" align="right" >
<input style="width:80%" type="text" value="Reg.office/Primary Office">
</td>
<td align="right">
<input style="width:30px" type="button" value="+" onclick="clonetable()">
<input style="width:30px" type="button" value="-" onclick="deltable()">
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td>
<div style="border:3px solid silver;border-radius:5px;background-color:#1E90FF">
<table align="center" style="width:99%" >
<tr >
<td align="left" style="width:50%">
<table width="100%">
<tr>
<td style="width:30%">
Effective Date
</td>
<td style="width:70%" >
<input style="background-color:white;width:44.5%" name="effdt" type="text" class="tcal">
</td>
</tr>
</table>
<td style="width:50%">
<table width="100%" >
<tr>
<td align="right">
Effective Status
</td>
<td style="width:45%">
<select name="eff_status" name="eff_status" style="float:right;width:145px" id="estatus">
<option value="Active" selected>Active</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>