SOLVE EDIT SAVE : RV

This commit is contained in:
venkateswaran ubuntu 2023-10-20 16:39:09 +05:30
parent 12519706fd
commit 3dc2980133
2 changed files with 17 additions and 64 deletions

View File

@ -602,8 +602,7 @@
<!-- The popup container --> <!-- The popup container -->
<div class="popup " id="popup"> <div class="popup " id="popup">
<ul id="output" class=""> <ul id="output" class="">
<div style="margin-bottom: 9px;">Reorder sections</div> Reorder sections
</ul> </ul>
<div class="popup-save form-button"> <div class="popup-save form-button">
<button onclick="saveFile(flag=1)" id="closePopupButton">Save</button> <button onclick="saveFile(flag=1)" id="closePopupButton">Save</button>
@ -2079,42 +2078,10 @@ markCalculation();
} }
//Function for Create a New Choice Field in a Choice Question //Function for Create a New Choice Field in a Choice Question
// function addNewChoice(NewaddChoiceAreaId = false , choiceName = false, questionRandomNo = false, choiceID = false, choice_mathEnabled= false) function addNewChoice(NewaddChoiceAreaId = false , choiceName = false, questionRandomNo = false, choiceID = false, choice_mathEnabled= false)
function addNewChoice(choiceObj) // function addNewChoice(choiceObj)
{ {
//set the default value to false
var choiceName = false;
var choiceID = false;
var choice_mathEnabled = false;
var editChoiceAreaId = false;
var addChoiceAreaId = false;
//set values from obj param if exists
if(choiceObj.hasOwnProperty('addChoiceAreaId')) {
addChoiceAreaId = choiceObj.addChoiceAreaId;
}else if (choiceObj.hasOwnProperty('editChoiceAreaId')){
editChoiceAreaId = choiceObj.editChoiceAreaId;
}else if (choiceObj.hasOwnProperty('choiceName')){
choiceName = choiceObj.choiceName;
}else if (choiceObj.hasOwnProperty('choiceID')){
choiceID = choiceObj.choiceID;
}else if (choiceObj.hasOwnProperty('choice_mathEnabled')){
choice_mathEnabled = choiceObj.choice_mathEnabled;
}
//end of set values from obj param if exists
addChoice = ""; addChoice = "";
const Choice_Group_Dynamic_UUID = uuidv4(); const Choice_Group_Dynamic_UUID = uuidv4();
@ -2137,15 +2104,16 @@ function addNewChoice(choiceObj)
</div> </div>
</div>` </div>`
if(editChoiceAreaId !== false) if(questionRandomNo)
{ {
var addChoiceAreaId2 = document.getElementById(editChoiceAreaId); var addChoiceAreaId = 'addChoiceArea_'+questionRandomNo;
addChoiceAreaId2.insertAdjacentHTML('beforeend', addChoice); var addChoiceAreaId2 = document.getElementById(addChoiceAreaId);
} addChoiceAreaId2.insertAdjacentHTML('beforeend', addChoice);
else if(addChoiceAreaId !== false) }
{ else if(NewaddChoiceAreaId)
addChoiceAreaId.insertAdjacentHTML('beforeend', addChoice); {
} NewaddChoiceAreaId.insertAdjacentHTML('beforeend', addChoice);
}
var newChoiceCommentButtonId = document.getElementById('newChoiceCommentButton_'+text_field_created_time+rnd_no); var newChoiceCommentButtonId = document.getElementById('newChoiceCommentButton_'+text_field_created_time+rnd_no);
@ -2735,12 +2703,7 @@ function ConstructAddNewChoiceID(e){
var addChoiceAreaTime = addChoiceArea.split("_")[1]; var addChoiceAreaTime = addChoiceArea.split("_")[1];
var addChoiceAreaId = 'addChoiceArea_'+addChoiceAreaTime; var addChoiceAreaId = 'addChoiceArea_'+addChoiceAreaTime;
var addChoiceAreaId2 = document.getElementById(addChoiceAreaId); var addChoiceAreaId2 = document.getElementById(addChoiceAreaId);
addNewChoice(addChoiceAreaId2)
var addChoiceAreaIdObject = {
'addChoiceAreaId' : addChoiceAreaId2
}
addNewChoice(addChoiceAreaIdObject)
} }

View File

@ -134,18 +134,8 @@ function QuestionsForEach(Question, questionAreaId, questionRandomNo){
var choiceName = choicenames.choice_name; var choiceName = choicenames.choice_name;
var choiceID = choicenames.id; var choiceID = choicenames.id;
var choice_mathEnabled = choicenames.is_math_enabled; var choice_mathEnabled = choicenames.is_math_enabled;
var editChoiceAreaId = 'addChoiceArea_'+questionRandomNo; addNewChoice(false , choiceName, questionRandomNo, choiceID, choice_mathEnabled);
var choiceObj = {
'choiceName' : choiceName,
'choiceID' : choiceID,
'choice_mathEnabled' : choice_mathEnabled,
'editChoiceAreaId' : editChoiceAreaId,
}
addNewChoice(choiceObj);
// addNewChoice(false , choiceName, questionRandomNo, choiceID, choice_mathEnabled);
}); });
} }