Hi All. Here’s my quandary: I have 5 Radio buttons, all of which have the same number of choices (around 20, all dynamically read in from another document). What I need to do is to make sure that the same choice is not picked in more than one of them. i.e. If they all have A, B & C, I need to make sure that no more than one of them has A selected. I need to do this on the fly. What I want to happen is that if the user selects one that has already been selected in another RB, it simply turns the selection back off. I don’t want any error popups or similar. I know how to do it on a notes client app, I just can’t figure out how to do it on a web form.
Point: I’ve searched the forums and didn’t find anything on validating one radio button against another.
Point: I know NOTHING about javascript, but I’ve come to believe that it’s the only way to do this. If there’s another way, I’d be overjoyed to hear it.
I attempted to modify a piece of javascript I found here on the forums (included below) and put it in the OnChange event on each field (with the number modified for that field), but it does not seem to work.
Any help would be greatly appreciated.
-Keith
//********************************************************
//variable defenitions
//********************************************************
var form = document.forms[0];
rbutton1 = form.ImptF1;
rbutton2 = form.ImptF2;
rbutton3 = form.ImptF3;
rbutton4 = form.ImptF4;
rbutton5 = form.ImptF5;
var RB1 = 0;
var RB2 = 0;
var RB3 = 0;
var RB4 = 0;
var RB5 = 0;
for (i=0;i<rbutton1.length;i++) {
if(rbutton[i].checked) RB1 = i;}
for (i=0;i<rbutton2.length;i++) {
if(rbutton[i].checked) RB2 = i;}
for (i=0;i<rbutton3.length;i++) {
if(rbutton[i].checked) RB3 = i;}
for (i=0;i<rbutton4.length;i++) {
if(rbutton[i].checked) RB4 = i;}
for (i=0;i<rbutton5.length;i++) {
if(rbutton[i].checked) RB5 = i}
if (RB1 != 0) {
if (RB1 = RB2) {
rbutton[RB1].checked = False;
}
if (RB1 = RB3) {
rbutton[RB1].checked = False;
}
if (RB1 = RB4) {
rbutton[RB1].checked = False;
}
if (RB1 = RB5) {
rbutton[RB1].checked = False;
}
}