mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
- Fixed issue with download button not working.
- Set button to only be active once the document has been validated. - Fixed issue where the report was simple text and not readable html.
This commit is contained in:
parent
65a988f13b
commit
dbaeedcef3
2 changed files with 10 additions and 5 deletions
|
|
@ -13,7 +13,7 @@ View [validator configuration](/server/config) or <a href="/server/health" targe
|
|||
<div>
|
||||
<label for="file">Choose a file</label>
|
||||
<input type="file" id="file" name="myFile">
|
||||
<input type="submit" id="submit" value="Validate" onclick="return validate();"><input type="button" id="dwn-btn" value="Download Report" onclick="return reporting();">
|
||||
<input type="button" id="submit" value="Validate" onclick="return validate();"><input type="button" id="dwn-btn" value="Download Report" onclick="return reporting();" disabled>
|
||||
</div>
|
||||
<div id="result"></div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -42,9 +42,10 @@
|
|||
|
||||
var report;
|
||||
|
||||
var validate = function () {
|
||||
var validate = function validate() {
|
||||
const input = document.getElementById('file');
|
||||
const output = document.getElementById('result');
|
||||
const download = document.getElementById('dwn-btn');
|
||||
|
||||
var headers = new Headers();
|
||||
headers.append('Content-Type', 'application/xml');
|
||||
|
|
@ -58,12 +59,16 @@
|
|||
|
||||
fetch('/', requestOptions)
|
||||
.then(response => response.text())
|
||||
.then(result => output.innerText = result)
|
||||
.then(result => {
|
||||
output.innerHTML = result;
|
||||
report = result;
|
||||
download.disabled = false;
|
||||
})
|
||||
.catch(error => output.innerText = result);
|
||||
return false;
|
||||
};
|
||||
|
||||
var reporting = function() {
|
||||
var reporting = function reporting() {
|
||||
var filename = "report.html";
|
||||
|
||||
var element = document.createElement('a');
|
||||
|
|
@ -76,7 +81,7 @@
|
|||
element.click();
|
||||
|
||||
document.body.removeChild(element);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue