Hi-
Someone was helping mewith this last night, and I thought that I had it all figured out until I realized that I don't have the an area to identify the value for each answer.
This is the problem, I need to develop a script that will rotate the order of the selections on a form. For example, if the question is How old are you and the selections (radio buttons) are 12, 13, and 14. This part Kev helped me out with. Now I have to be able to pass the value of each selection, right now I'm just getting "on", but I need an actual value, here is the current code:
<html>
<head>
<script>
var arrayOfData1 = ["Buying","Refinancing","Other"];
var arrayOfData2 = ["Rates are too high",
"I don't trust that my personal online",
"I didn't want to be charged an application fee ",
"I never enter my credit card information online",
"I had too many questions about the application process "];
var arrayOfData3 = ["Accessed the Glossary sectionof the web site",
"Called the 800# ",
"Left the web site "];
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
function rnd() {
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};
function rand(number) {
return Math.floor(rnd()*number);
};
function writeRadioButton(name, array) {
while (array.length > 0) {
var randOption = rand(array.length);
document.write('<INPUT TYPE="RADIO" NAME="' + name + '" > ' +
array[randOption] + '<BR>');
array[randOption] = array[array.length - 1]
--array.length;
}
}
</script>
</head>
<body>
<form method="post" action="onsubmit="return checkRequired(this)">
<INPUT type="hidden" NAME="form_version" VALUE="1"/>
<INPUT type="hidden" NAME="source_site" VALUE="VAL1"/>
<INPUT type="hidden" NAME="thankyou"
VALUE="<INPUT type="hidden" NAME="thankyou_page" VALUE=""/>
<INPUT type="hidden" NAME="fieldorder"
VALUE="Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14,Q15,Q16,Q17,Q18"/
>
<p><b>Please tell us your interest in visiting our website:</b><br>
<script>
writeRadioButton("Q01", arrayOfData1)
</script>
<p><b>If you did not complete & submit our online application, what was the top
reason that prevented you from doing so?</b><br>
<script>
writeRadioButton("Q02", arrayOfData2)
</script>
<p><b>If you had a question while on our web site, what action did you take to
help get an answer to your question?</b><br>
<script>
writeRadioButton("Q03", arrayOfData3)
</script>
</form>
</body>
</html>
Someone was helping mewith this last night, and I thought that I had it all figured out until I realized that I don't have the an area to identify the value for each answer.
This is the problem, I need to develop a script that will rotate the order of the selections on a form. For example, if the question is How old are you and the selections (radio buttons) are 12, 13, and 14. This part Kev helped me out with. Now I have to be able to pass the value of each selection, right now I'm just getting "on", but I need an actual value, here is the current code:
<html>
<head>
<script>
var arrayOfData1 = ["Buying","Refinancing","Other"];
var arrayOfData2 = ["Rates are too high",
"I don't trust that my personal online",
"I didn't want to be charged an application fee ",
"I never enter my credit card information online",
"I had too many questions about the application process "];
var arrayOfData3 = ["Accessed the Glossary sectionof the web site",
"Called the 800# ",
"Left the web site "];
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
function rnd() {
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};
function rand(number) {
return Math.floor(rnd()*number);
};
function writeRadioButton(name, array) {
while (array.length > 0) {
var randOption = rand(array.length);
document.write('<INPUT TYPE="RADIO" NAME="' + name + '" > ' +
array[randOption] + '<BR>');
array[randOption] = array[array.length - 1]
--array.length;
}
}
</script>
</head>
<body>
<form method="post" action="onsubmit="return checkRequired(this)">
<INPUT type="hidden" NAME="form_version" VALUE="1"/>
<INPUT type="hidden" NAME="source_site" VALUE="VAL1"/>
<INPUT type="hidden" NAME="thankyou"
VALUE="<INPUT type="hidden" NAME="thankyou_page" VALUE=""/>
<INPUT type="hidden" NAME="fieldorder"
VALUE="Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14,Q15,Q16,Q17,Q18"/
>
<p><b>Please tell us your interest in visiting our website:</b><br>
<script>
writeRadioButton("Q01", arrayOfData1)
</script>
<p><b>If you did not complete & submit our online application, what was the top
reason that prevented you from doing so?</b><br>
<script>
writeRadioButton("Q02", arrayOfData2)
</script>
<p><b>If you had a question while on our web site, what action did you take to
help get an answer to your question?</b><br>
<script>
writeRadioButton("Q03", arrayOfData3)
</script>
</form>
</body>
</html>