diff --git a/addform.html b/addform.html index 2b3f03f..47d7afa 100644 --- a/addform.html +++ b/addform.html @@ -602,8 +602,7 @@ ` - if(editChoiceAreaId !== false) - { - var addChoiceAreaId2 = document.getElementById(editChoiceAreaId); - addChoiceAreaId2.insertAdjacentHTML('beforeend', addChoice); - } - else if(addChoiceAreaId !== false) - { - addChoiceAreaId.insertAdjacentHTML('beforeend', addChoice); - } + if(questionRandomNo) + { + var addChoiceAreaId = 'addChoiceArea_'+questionRandomNo; + var addChoiceAreaId2 = document.getElementById(addChoiceAreaId); + addChoiceAreaId2.insertAdjacentHTML('beforeend', addChoice); + } + else if(NewaddChoiceAreaId) + { + NewaddChoiceAreaId.insertAdjacentHTML('beforeend', addChoice); + } var newChoiceCommentButtonId = document.getElementById('newChoiceCommentButton_'+text_field_created_time+rnd_no); @@ -2735,12 +2703,7 @@ function ConstructAddNewChoiceID(e){ var addChoiceAreaTime = addChoiceArea.split("_")[1]; var addChoiceAreaId = 'addChoiceArea_'+addChoiceAreaTime; var addChoiceAreaId2 = document.getElementById(addChoiceAreaId); - - var addChoiceAreaIdObject = { - 'addChoiceAreaId' : addChoiceAreaId2 - } - - addNewChoice(addChoiceAreaIdObject) + addNewChoice(addChoiceAreaId2) } diff --git a/json2html.js b/json2html.js index 2c036c8..335e651 100644 --- a/json2html.js +++ b/json2html.js @@ -134,18 +134,8 @@ function QuestionsForEach(Question, questionAreaId, questionRandomNo){ var choiceName = choicenames.choice_name; var choiceID = choicenames.id; var choice_mathEnabled = choicenames.is_math_enabled; - - var editChoiceAreaId = 'addChoiceArea_'+questionRandomNo; - - var choiceObj = { - 'choiceName' : choiceName, - 'choiceID' : choiceID, - 'choice_mathEnabled' : choice_mathEnabled, - 'editChoiceAreaId' : editChoiceAreaId, - } - - addNewChoice(choiceObj); - // addNewChoice(false , choiceName, questionRandomNo, choiceID, choice_mathEnabled); + + addNewChoice(false , choiceName, questionRandomNo, choiceID, choice_mathEnabled); }); }