Commit 81da60f3 authored by Mark Boas's avatar Mark Boas
Browse files

Merge branch '38-clear-localstorage' into 'main'

added clear agreement button and code

Closes #38

See merge request mova/waterfall!18
parents a484a6b8 e46e6d05
......@@ -281,7 +281,8 @@
<ul id="sortlist">
</ul>
<button onclick="saveAgreement(); return false">Save agreement<i class="gg-check-r"></i></button>&nbsp;<button class="button-secondary" disabled>Generate agreement</button>
<button onclick="saveAgreement(); return false">Save agreement<i class="gg-check-r"></i></button>&nbsp;<button class="button-secondary" disabled>Generate agreement</button><button class="button-secondary float-right clear-button" onclick="if(confirm('Are you sure you want to delete this agreement')) { clearAgreement();} return false;">Clear</button>
</fieldset>
</form>
</div>
......
......@@ -20,7 +20,6 @@ function getOptionIndex(selectElement, value) {
}
}
function formatDate(d) {
let month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
......@@ -39,7 +38,20 @@ function formatDate(d) {
}
return [year, month, day].join('-');
}
function clearAgreement() {
localStorage.clear();
const inputs = document.querySelectorAll("input");
inputs.forEach(el => {
el.value = "";
});
const selects = document.querySelectorAll("select");
selects.forEach(el => {
el.selectedIndex = 0;
});
}
function checkCap(el) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment