|
@@ -357,10 +357,23 @@ function getFormData() {
|
357
|
357
|
// Empties the form fields
|
358
|
358
|
// return: nothing
|
359
|
359
|
function cleanForm() {
|
360
|
|
- document.getElementById(prefix + '_' + items.name + '_input').value = '';
|
361
|
|
- document.getElementById(prefix + '_' + items.addr + '_input').value = '';
|
362
|
|
- document.getElementById(prefix + '_' + items.subj + '_input').value = '';
|
363
|
|
- document.getElementById(prefix + '_' + items.text + '_textarea').value = '';
|
|
360
|
+ // Select the field
|
|
361
|
+ let index = 0;
|
|
362
|
+ if(labels) {
|
|
363
|
+ index = 1;
|
|
364
|
+ }
|
|
365
|
+
|
|
366
|
+ // Iterate over all the fields
|
|
367
|
+ for(let field in DOMFields) {
|
|
368
|
+ let el = DOMFields[field].children[index];
|
|
369
|
+ // If it's a <select> element, select the first element so it looks
|
|
370
|
+ // like a reset
|
|
371
|
+ if(!el.tagName.toLowerCase().localeCompare('select')) {
|
|
372
|
+ el.children[0].selected = true;
|
|
373
|
+ } else {
|
|
374
|
+ el.value = '';
|
|
375
|
+ }
|
|
376
|
+ }
|
364
|
377
|
}
|
365
|
378
|
|
366
|
379
|
|