I am trying to create a single select box based on a dynamic array. However, it appears that only the last value in the array is populating the dropdown. Any help would be appreciated. Here is a snippit of the function:
if (questionsArray.questionType == "Drop Down"
{
// output the answers
document.writeln("<tr><td align='left'><SELECT class='form' name='" + questionsArray.questionEID + "'"
if (questionsArray.answer1 != ""
document.writeln("<option value='Answer 1'>"
+ questionsArray.answer1 + "</option>"
if (questionsArray.answer2 != ""
document.writeln("<option value='Answer 2'>"
+ questionsArray.answer2 + "</option>"
if (questionsArray.answer3 != ""
document.writeln("<option value='Answer 3'>"
+ questionsArray.answer1 + "</option>"
document.writeln("</select></td></tr>"
}
if (questionsArray.questionType == "Drop Down"
{
// output the answers
document.writeln("<tr><td align='left'><SELECT class='form' name='" + questionsArray.questionEID + "'"
if (questionsArray.answer1 != ""
document.writeln("<option value='Answer 1'>"
+ questionsArray.answer1 + "</option>"
if (questionsArray.answer2 != ""
document.writeln("<option value='Answer 2'>"
+ questionsArray.answer2 + "</option>"
if (questionsArray.answer3 != ""
document.writeln("<option value='Answer 3'>"
+ questionsArray.answer1 + "</option>"
document.writeln("</select></td></tr>"
}