# HG changeset patch # User Nicholas Jillings # Date 1433244259 -3600 # Node ID 155019bf86b5e7626012257aba645df438e2aa2a # Parent 59a8370a2e9702fc847a790dc6c7dc06633de284 create_test: Added crude validation tool. diff -r 59a8370a2e97 -r 155019bf86b5 test_create/test_create.html --- a/test_create/test_create.html Tue Jun 02 11:24:23 2015 +0100 +++ b/test_create/test_create.html Tue Jun 02 12:24:19 2015 +0100 @@ -24,11 +24,19 @@ }; - function attributePair(string, type){ + function attributePair(string, type, mandatory){ var id = document.createElement("span"); id.textContent = string; var input = document.createElement("input"); input.type = type; + if (type == 'text') { + if (mandatory == true) { + input.setAttribute('mandatory','true'); + } + else { + input.setAttribute('mandatory','false'); + } + } return [id, input]; } @@ -36,6 +44,56 @@ event.srcElement.parentElement.parentElement.removeChild(event.srcElement.parentElement); } + function buttonClickedValidate() { + var ready = validate(); + if (ready == false) { + var errMsg = document.getElementById('errorMessage'); + errMsg.textContent = "There were some errors with your XML. Any input boxes highlighted in red are invalid because they are empty. Please fill these in correctly. Any boxes which are yellow are not-invalid but will use the default value."; + errMsg.style.visibility = 'visible'; + document.getElementById('createXML').disabled = true; + + } else { + var errMsg = document.getElementById('errorMessage'); + errMsg.textContent = ""; + errMsg.style.visiblity = 'hidden'; + document.getElementById('createXML').disabled = false; + } + } + + function validate() { + var canExport = true; + // Checks if the XML can be created from the given entries + var inputs = document.getElementsByTagName('input'); + for (var i=0; i

Create Test Setup XML

+ + +
@@ -255,7 +316,7 @@ Project Return - + Randomise Test Page Order Collect Session Metrics