Hi,
I have built a site where i display data from a contact table, to a .asp webpage. Next to each record i have a checkbox (within the loop) which contains the contacts uniqueid.
What i have at the moment is the ability to check the first checkbox from the recordset and have that value insert in to a hidden text field, and there after any other checkboxes that are checked, will have the uniqueid added to the hiddenfield. However there are two issues with this.
1st: If the user doesn’t select the first checkbox on each page, the values do not get captured. The same applies on the following pages, this is obviously no good as the user might want to select everything other than the first record on each page, and that means no results are captured.
2nd: I also need the ability to click something (checkbox / link) and have all the checkboxes on a page ticked to save the manual process of going through each record. The problem with this is it does not capture any of the uniqueid's the way i have done it.
Could anyone offer me any help with this, it would be really appreciated.
JavaScript Value Capture: - Current code
Check all Checkboxes on the page: - Current code
I have built a site where i display data from a contact table, to a .asp webpage. Next to each record i have a checkbox (within the loop) which contains the contacts uniqueid.
What i have at the moment is the ability to check the first checkbox from the recordset and have that value insert in to a hidden text field, and there after any other checkboxes that are checked, will have the uniqueid added to the hiddenfield. However there are two issues with this.
1st: If the user doesn’t select the first checkbox on each page, the values do not get captured. The same applies on the following pages, this is obviously no good as the user might want to select everything other than the first record on each page, and that means no results are captured.
2nd: I also need the ability to click something (checkbox / link) and have all the checkboxes on a page ticked to save the manual process of going through each record. The problem with this is it does not capture any of the uniqueid's the way i have done it.
Could anyone offer me any help with this, it would be really appreciated.
JavaScript Value Capture: - Current code
Code:
var myvalue
function mytester(myvalue,myname){
tester='document.getElementById("'+myname+'").checked'
if (eval(tester))
{
if (document.results.compareitems.value=='')
{
document.results.compareitems.value=myvalue+'/'
//alert(myvalue)
}
else
{
document.results.compareitems.value = document.results.compareitems.value+myvalue+'/'
}
}
else
{
document.results.compareitems.value=document.results.compareitems.value.replace(','+myvalue+',', '');
}
}
Check all Checkboxes on the page: - Current code
Code:
function checkAll() {
var is_checked = document.results.checkbox.checked;
//alert(is_checked);
var cbs = document.results.elements["checkbox1863"];
for (var i=0; i<cbs.length; i++) {
cbs[i].checked = is_checked;
}
}