Hi everybody,
I am pretty new at using JavaScript. SO I have having a bit of a problem.
I have a list of checkboxes, which are named dynamically with values from the database. I also have a list of radio buttons which have values which match the names of the corresponding checkbox. (I know..a little confusing...sorry)
So what I need to happen is this:
When a user selects a radio button, I need the corresponding checkbox to become checked.
This is what I have so far...it's probably completely of base:
function setcheck(form) {
for (var i=0; i<form.DefaultDash.length; i++) {
if (form.DefaultDash.checked){
var checkboxname = form.DefaultDash.value;
alert(document.forms[0].eval("check_"+checkboxname+".name"));
document.forms[0].eval("check_"+checkboxname+".name").checked = true;
break
}
}
}
I am pretty new at using JavaScript. SO I have having a bit of a problem.
I have a list of checkboxes, which are named dynamically with values from the database. I also have a list of radio buttons which have values which match the names of the corresponding checkbox. (I know..a little confusing...sorry)
So what I need to happen is this:
When a user selects a radio button, I need the corresponding checkbox to become checked.
This is what I have so far...it's probably completely of base:
function setcheck(form) {
for (var i=0; i<form.DefaultDash.length; i++) {
if (form.DefaultDash.checked){
var checkboxname = form.DefaultDash.value;
alert(document.forms[0].eval("check_"+checkboxname+".name"));
document.forms[0].eval("check_"+checkboxname+".name").checked = true;
break
}
}
}