# HG changeset patch # User Nicholas Jillings # Date 1433244259 -3600 # Node ID 2dc00907c6abe97d5bcddee570fadc2e8d5ec183 # Parent 7a7a72880996ca8e7edb9d575a6aef34949b955d create_test: Added crude validation tool. diff -r 7a7a72880996 -r 2dc00907c6ab 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