tedc83
05-11-2005, 02:34 PM
Hi all! Im new to this forum so I will give it a shoot and post my first thread... Im trying to do something with PHP and Javascript together. I have an array in PHP which I have already successfully passed over to a Javascript array. The array comes from a table of restricted businesses.
So, what I need to do is when a user clicks on a radio button that says "no my business is not one of the following" then I need to disable all the checkboxes of the restricted businesses. (since they come from the same array, the amount of checkboxes are the same as the amount of values in the array)
So my main problem is that the checkbox names have quared brackets like this:
<input type="checkbox" name="rb[1]">
So I am calling the following function when I hit the radio
function disableNoBiz(){
var x = rbjsA;
for (var i = 0;i<x.length;i++){
document.quoteService.rb[i].disabled = true;
}
}
rbjsA is the array which contains all the restricted businesses. So I see that somehow I need to concatenate the squared brackets because it is understanding them as something else other than the name of the field.
Any ideas anyone?
Thanks!
Ted
So, what I need to do is when a user clicks on a radio button that says "no my business is not one of the following" then I need to disable all the checkboxes of the restricted businesses. (since they come from the same array, the amount of checkboxes are the same as the amount of values in the array)
So my main problem is that the checkbox names have quared brackets like this:
<input type="checkbox" name="rb[1]">
So I am calling the following function when I hit the radio
function disableNoBiz(){
var x = rbjsA;
for (var i = 0;i<x.length;i++){
document.quoteService.rb[i].disabled = true;
}
}
rbjsA is the array which contains all the restricted businesses. So I see that somehow I need to concatenate the squared brackets because it is understanding them as something else other than the name of the field.
Any ideas anyone?
Thanks!
Ted