comparison test_create/test_create.html @ 1895:37c5e99ef828

Fixed test creator <surveyentry> options. Updated interface-specs for ABX.
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Wed, 16 Mar 2016 15:17:04 +0000
parents 1d0936cfa1d4
children 3600fff74af9
comparison
equal deleted inserted replaced
1894:3342ca63f423 1895:37c5e99ef828
234 var node = doc.createElement('surveyentry'); 234 var node = doc.createElement('surveyentry');
235 node.setAttribute('type',this.type); 235 node.setAttribute('type',this.type);
236 var statement = doc.createElement('statement'); 236 var statement = doc.createElement('statement');
237 statement.textContent = this.statement; 237 statement.textContent = this.statement;
238 node.appendChild(statement); 238 node.appendChild(statement);
239 if (this.type != "statement") { 239 node.id = this.id;
240 node.id = this.id; 240 if (this.name != undefined) { node.setAttribute("name",this.name);}
241 if (this.name != undefined) { node.setAttribute("name",this.name);} 241 if (this.mandatory != undefined) { node.setAttribute("mandatory",this.mandatory);}
242 if (this.mandatory != undefined) { node.setAttribute("mandatory",this.mandatory);} 242 node.id = this.id;
243 switch(this.type) 243 if (this.name != undefined) {node.setAttribute("name",this.name);}
244 { 244 switch(this.type)
245 case "question": 245 {
246 if (this.boxsize != undefined) {node.setAttribute("boxsize",this.boxsize);}
247 break;
248 case "number":
249 if (this.min != undefined) {node.setAttribute("min", this.min);}
250 if (this.max != undefined) {node.setAttribute("max", this.max);}
251 break;
252 case "checkbox": 246 case "checkbox":
253 case "radio": 247 case "radio":
254 for (var i=0; i<this.options.length; i++) 248 for (var i=0; i<this.options.length; i++)
255 { 249 {
256 var option = this.options[i]; 250 var option = this.options[i];
257 var optionNode = doc.createElement("option"); 251 var optionNode = doc.createElement("option");
258 optionNode.setAttribute("name",option.name); 252 optionNode.setAttribute("name",option.name);
259 optionNode.textContent = option.text; 253 optionNode.textContent = option.text;
260 node.appendChild(optionNode); 254 node.appendChild(optionNode);
261 } 255 }
256 case "number":
257 if (this.min != undefined) {node.setAttribute("min", this.min);}
258 if (this.max != undefined) {node.setAttribute("max", this.max);}
259 case "question":
260 if (this.boxsize != undefined) {node.setAttribute("boxsize",this.boxsize);}
261 if (this.mandatory != undefined) {node.setAttribute("mandatory",this.mandatory);}
262 default:
262 break; 263 break;
263 }
264 } 264 }
265 return node; 265 return node;
266 }; 266 };
267 }; 267 };
268 this.decode = function(parent,xml) { 268 this.decode = function(parent,xml) {