I have values of checkbox and as soon as I click delete the values and the type must be sent to a servlet called DeleteServlet. Please help me how to send the values?
<html>
<head>
<script type="text/javascript">
function get_check_value(chkbox){
if(chkbox.checked){
var Values=chkbox.value;
//send this Values to servlet
}
}
function doDelete(theClick){
var type=theClick;
//send this type to servlet
alert(type);
}
</script>
</head>
<%String user=request.getParameter("Users"); %>
<body>
<%
String User[]=user.trim().split(" ");
for(int i=0;i<User.length;i++){%>
<center>
<form name='list' action='AddUserServlet'>
<% out.println("<input type='checkbox' name='user" + i + "' value='"+ User[i] + "' onClick='return get_check_value(this)'>" + User[i]+ "</input>" ); %>
</form>
<%}%>
<input type="submit" value="ADD" name="b1" >
<input type="submit" value="MODIFY" name="b1">
<input type="submit" value="DELETE" name="b1" onClick="return doDelete(value)" >
</center>
</body>
</html>
I tried this "document.list.user.value" in an alert box it comes as undefined object. To send to a servlet I tried the following line but nothing is read
chk_val=chkbox.value;
document.add.action = "AddUserServlet?type=delete&name="+chk_val;
document.add.submit();