I am trying to check on a checkbox to select one, many or all and send them to be printed when the user clicks on the "print me" button. I am lost on this one, has anyone done anything similar that I can see how it can be done right? Here is my test code for my issue.
<!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=UTF-8" />
<title>Select and Print</title>
<script src="/jquery-1.11.min.js"></script>
<script>
$(document).ready(function() {
$('#selecctall').click(function(event) {
if(this.checked) {
$('.checkbox1').each(function() {
this.checked = true; // select all checkboxes with class "checkbox1"
printDoc(docUrl);
});
}else{
$('.checkbox1').each(function() {
this.checked = false; // deselect all checkboxes with class "checkbox1"
});
}
});
});
function printDoc(gotUrl) {
var doc = window.open(gotUrl);
doc.print();
doc.close();
}
</script>
</head>
<body><form action="doit.pl" method="post">
</br>
<input type="checkbox" id="selecctall"/> Select All
<input class="checkbox1" type="checkbox" name="check[]" value="names.html"></br>
<input class="checkbox1" type="checkbox" name="check[]" value="copy.html"></br>
<input class="checkbox1" type="checkbox" name="check[]" value="card.html"></br>
<input class="checkbox1" type="checkbox" name="check[]" value="page.html"></br>
<input class="checkbox1" type="checkbox" name="check[]" value="test.html"></br>
<input type="submit" name="print me"></br>
</body></form>
</html>
Thanks for the Help!