Added ability to insert comments
This commit is contained in:
parent
5dc5d0c728
commit
95aa220199
59
fillcomments.js
Normal file
59
fillcomments.js
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
|
||||||
|
function doComments(id,qid) {
|
||||||
|
|
||||||
|
let survey=document.getElementById("surveyId").value;
|
||||||
|
console.log("Survey is:"+survey);
|
||||||
|
|
||||||
|
let Q1=document.getElementById("location").value;
|
||||||
|
let Q2=document.getElementById("level").value;
|
||||||
|
let Q3=document.getElementById("gov").value;
|
||||||
|
|
||||||
|
|
||||||
|
// Create the form data object
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('qid', qid);
|
||||||
|
formData.append('survey', survey);
|
||||||
|
formData.append('Q1', Q1);
|
||||||
|
formData.append('Q2', Q2);
|
||||||
|
formData.append('Q3', Q3);
|
||||||
|
|
||||||
|
// Send the form data using fetch
|
||||||
|
fetch('get_text_data.php', {
|
||||||
|
method: 'POST',
|
||||||
|
body: formData
|
||||||
|
})
|
||||||
|
.then(response => response.text())
|
||||||
|
.then(data => {
|
||||||
|
// Output result
|
||||||
|
//console.log(data);
|
||||||
|
const parsed = JSON.parse(data);
|
||||||
|
|
||||||
|
const div = document.getElementById(id);
|
||||||
|
|
||||||
|
// Create a new <ul> element
|
||||||
|
const ul = document.createElement("ul");
|
||||||
|
|
||||||
|
parsed.forEach(item => {
|
||||||
|
const li = document.createElement("li");
|
||||||
|
li.textContent = item.text;
|
||||||
|
ul.appendChild(li);
|
||||||
|
|
||||||
|
console.log(item.text);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Optionally, add some list items
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Append the <ul> to the div
|
||||||
|
div.appendChild(ul);
|
||||||
|
|
||||||
|
|
||||||
|
// Re-enable body, and revert cursor
|
||||||
|
return;
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
});
|
||||||
|
}
|
@ -7,6 +7,7 @@
|
|||||||
<script src="./drawtriangle.js"></script>
|
<script src="./drawtriangle.js"></script>
|
||||||
<script src="./drawtriangleinverted.js"></script>
|
<script src="./drawtriangleinverted.js"></script>
|
||||||
<script src="./drawbar.js"></script>
|
<script src="./drawbar.js"></script>
|
||||||
|
<script src="./fillcomments.js"></script>
|
||||||
<script src="./savesvg.js"></script>
|
<script src="./savesvg.js"></script>
|
||||||
<script src="./populateGraphics.js"></script>
|
<script src="./populateGraphics.js"></script>
|
||||||
<script src="./insertQualifiers.js"></script>
|
<script src="./insertQualifiers.js"></script>
|
||||||
@ -100,6 +101,13 @@
|
|||||||
text-anchor: middle;
|
text-anchor: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.comments {
|
||||||
|
height: 200px;
|
||||||
|
margin: 10px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
background-color: #EEE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@ -198,7 +206,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<p>Please add any additional comments:</p>
|
<p>Please add any additional comments: <button onclick="doComments('greatOwners','QID48_TEXT')">Load comments</button></p>
|
||||||
|
<div class="comments" id="greatOwners">
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -216,8 +226,10 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg2_4" width="800" height="200"></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" id="svg2_4" width="800" height="200"></svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Please add any additional comments:</p>
|
|
||||||
|
|
||||||
|
<p>Please add any additional comments: <button onclick="doComments('greatLeaders','QID60_TEXT')">Load comments</button></p>
|
||||||
|
<div class="comments" id="greatLeaders">
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -240,7 +252,9 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg3_6" width="800" height="200"></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" id="svg3_6" width="800" height="200"></svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Please add any additional comments:</p>
|
<p>Please add any additional comments: <button onclick="doComments('greatGovernance','QID59_TEXT')">Load comments</button></p>
|
||||||
|
<div class="comments" id="greatGovernance">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
@ -273,7 +287,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<p>Please add any additional comments:</p>
|
<p>Please add any additional comments: <button onclick="doComments('greatCulture','QID47_TEXT')">Load comments</button></p>
|
||||||
|
<div class="comments" id="greatCulture">
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -292,7 +308,9 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg5_4" width="800" height="200"></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" id="svg5_4" width="800" height="200"></svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Q24 Please add any additional comments:</p>
|
<p>Please add any additional comments: <button onclick="doComments('greatEngagement','QID62_TEXT')">Load comments</button></p>
|
||||||
|
<div class="comments" id="greatEngagement">
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -311,7 +329,9 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg6_4" width="800" height="200"></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" id="svg6_4" width="800" height="200"></svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Q26 Please add any additional comments:</p>
|
<p>Please add any additional comments: <button onclick="doComments('greatStewardship','QID61_TEXT')">Load comments</button></p>
|
||||||
|
<div class="comments" id="greatStewardship">
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -344,7 +364,9 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg7_4" width="800" height="200"></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" id="svg7_4" width="800" height="200"></svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Q29 Please add any additional comments:</p>
|
<p>Please add any additional comments: <button onclick="doComments('greatStrategy','QID49_TEXT')">Load comments</button></p>
|
||||||
|
<div class="comments" id="greatStrategy">
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -365,7 +387,9 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg8_5" width="800" height="200"></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" id="svg8_5" width="800" height="200"></svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Please add any additional comments:</p>
|
<p>Please add any additional comments: <button onclick="doComments('greatInnovation','QID64_TEXT')">Load comments</button></p>
|
||||||
|
<div class="comments" id="greatInnovation">
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -382,7 +406,9 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg9_3" width="800" height="200"></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" id="svg9_3" width="800" height="200"></svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Please add any additional comments:</p>
|
<p>Please add any additional comments: <button onclick="doComments('greatAdvantage','QID63_TEXT')">Load comments</button></p>
|
||||||
|
<div class="comments" id="greatAdvantage">
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -414,7 +440,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<p>Please add any additional comments:</p>
|
<p>Please add any additional comments: <button onclick="doComments('greatMeasurement','QID50_TEXT')">Load comments</button></p>
|
||||||
|
<div class="comments" id="greatMeasurement">
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -433,7 +461,9 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg11_4" width="800" height="200"></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" id="svg11_4" width="800" height="200"></svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Please add any additional comments:</p>
|
<p>Please add any additional comments: <button onclick="doComments('greatEvaluation','QID66_TEXT')">Load comments</button></p>
|
||||||
|
<div class="comments" id="greatEvaluation">
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -463,7 +493,9 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" id="svg12_10" width="800" height="200"></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" id="svg12_10" width="800" height="200"></svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Please add any additional comments:</p>
|
<p>Please add any additional comments: <button onclick="doComments('greatImpact','QID65_TEXT')">Load comments</button></p>
|
||||||
|
<div class="comments" id="greatImpact">
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user