Hi,
I have tried to write some code which will check the value of multiple radio groups and if any of the vales equal "Fail" then it will put "Fail" into a textbox otherwise it will put "Pass", however it does not seem to work.
Could someone tell me where I am going wrong please
Then on my page I have
Regards
Paul
I have tried to write some code which will check the value of multiple radio groups and if any of the vales equal "Fail" then it will put "Fail" into a textbox otherwise it will put "Pass", however it does not seem to work.
Could someone tell me where I am going wrong please
Code:
<script type="text/javascript">
function pfStatus() {
var r1 = document.forms["frmTK"].radChop;
var r2 = document.forms["frmTK"].radSlit;
var r3 = document.forms["frmTK"].radScore;
var r4 = document.forms["frmTK"].radQB;
var r5 = document.forms["frmTK"].radWarp;
var r6 = document.forms["frmTK"].radFlute;
var v1 = getSelectedRadio(r1);
var v2 = getSelectedRadio(r2);
var v3 = getSelectedRadio(r3);
var v4 = getSelectedRadio(r4);
var v5 = getSelectedRadio(r5);
var v6 = getSelectedRadio(r6);
var z1 = r1[v1].value;
var z2 = r2[v2].value;
var z3 = r3[v3].value;
var z4 = r1[v4].value;
var z5 = r2[v5].value;
var z6 = r3[v6].value;
if ((z1 == "Fail") || (z2 == "Fail") || (z3 == "Fail") || (z4 == "Fail") || (z5 == "Fail") || (z6 == "Fail")) {
document.frmTK.txtFailure.value = "Fail";
} else {
document.frmTK.txtFailure.value = "Pass";
}
}
</script>
Code:
onClick="pfStatus()"
Regards
Paul