# HG changeset patch # User Nicholas Jillings # Date 1433244259 -3600 # Node ID 918d9a5943cdf390698a01443c1c7e4e958f9d03 # Parent f0fb39c61967b0488bb705ff73f2547891d04ed6 create_test: Added crude validation tool. diff -r f0fb39c61967 -r 918d9a5943cd 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