diff test_create/test_create.html @ 544:e0f95b33ba31 Dev_main

Bug Fix #1611 : Generates valid XML from examples.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Mon, 22 Feb 2016 14:55:16 +0000
parents a95d323a911e
children 4ee95cb8ff55
line wrap: on
line diff
--- a/test_create/test_create.html	Mon Feb 22 14:38:45 2016 +0000
+++ b/test_create/test_create.html	Mon Feb 22 14:55:16 2016 +0000
@@ -230,7 +230,7 @@
 
                     this.exportXML = function(doc)
                     {
-                        var node = doc.createElement('surveyelement');
+                        var node = doc.createElement('surveyentry');
                         node.setAttribute('type',this.type);
                         var statement = doc.createElement('statement');
                         statement.textContent = this.statement;
@@ -241,15 +241,14 @@
                             break;
                         case "question":
                             node.id = this.id;
-                            node.setAttribute("mandatory",this.mandatory);
-                            node.setAttribute("boxsize",this.boxsize);
+                            if (this.mandatory != undefined) { node.setAttribute("mandatory",this.mandatory);}
+                            if (this.boxsize != undefined) {node.setAttribute("boxsize",this.boxsize);}
                             break;
                         case "number":
                             node.id = this.id;
-                            node.setAttribute("mandatory",this.mandatory);
-                            node.setAttribute("min", this.min);
-                            node.setAttribute("max", this.max);
-                            node.setAttribute("step", this.step);
+                            if (this.mandatory != undefined) { node.setAttribute("mandatory",this.mandatory);}
+                            if (this.min != undefined) {node.setAttribute("min", this.min);}
+                            if (this.max != undefined) {node.setAttribute("max", this.max);}
                             break;
                         case "checkbox":
                         case "radio":