...Hello All.
Well out of my depth here doing the usual forms in php and such, so any help would be much appreciated.
I've been asked by a client to produce a questionnaire using radio boxes that are scored from 5 to 1, and there's 24 questions in total. And a number of html pages that are called on depending on the final score.
I've modelled the new doc on an old one based on 11 questions, it's returning a value but always the same and I have no idea what this means below:
<script language="JavaScript">
aLinks = new Array("24-40.html","41-60.html","61-80.html","81-120.html");
function CheckForm(){
var errString = "";
var iScore=0;
for (iRad = 1; iRad < 24; iRad ++){
bFlag = false;
iScr = 0
myArray = document.Form1.elements["val" + iRad];
for (iVal = 0; iVal < 5; iVal ++){
if (myArray[iVal].checked){
bFlag = true;
iScr = parseInt(myArray[iVal].value);
}
}
if (!bFlag){
errString = "Please ensure you provide an answer for each question!";
}
iScore += iScr;
}
if (errString != ""){
alert (errString);
}
else {
iScore = Math.ceil((iScore - 24)/24)-1;
iScore = (iScore == -1 ? iScore = 0 : iScore = iScore);
window.open(aLinks[iScore],'RCHPOP2','scrollbars=1,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,width=670,height=300');
}
}
</script
This is the easy part he wants the forms returned to be dependant not only the total score but on certain scores for certain questions. god help me.
Thanks
Well out of my depth here doing the usual forms in php and such, so any help would be much appreciated.
I've been asked by a client to produce a questionnaire using radio boxes that are scored from 5 to 1, and there's 24 questions in total. And a number of html pages that are called on depending on the final score.
I've modelled the new doc on an old one based on 11 questions, it's returning a value but always the same and I have no idea what this means below:
<script language="JavaScript">
aLinks = new Array("24-40.html","41-60.html","61-80.html","81-120.html");
function CheckForm(){
var errString = "";
var iScore=0;
for (iRad = 1; iRad < 24; iRad ++){
bFlag = false;
iScr = 0
myArray = document.Form1.elements["val" + iRad];
for (iVal = 0; iVal < 5; iVal ++){
if (myArray[iVal].checked){
bFlag = true;
iScr = parseInt(myArray[iVal].value);
}
}
if (!bFlag){
errString = "Please ensure you provide an answer for each question!";
}
iScore += iScr;
}
if (errString != ""){
alert (errString);
}
else {
iScore = Math.ceil((iScore - 24)/24)-1;
iScore = (iScore == -1 ? iScore = 0 : iScore = iScore);
window.open(aLinks[iScore],'RCHPOP2','scrollbars=1,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,width=670,height=300');
}
}
</script
This is the easy part he wants the forms returned to be dependant not only the total score but on certain scores for certain questions. god help me.
Thanks