changeset 2571:161d63a60b9e

Fix for #142. Possible to submit ann empty radio survey entry. The <response> node will be empty.
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 18 Oct 2016 12:30:12 +0100
parents 521aa69517c4
children 2728c31f80cd
files js/core.js
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/js/core.js	Tue Oct 18 12:22:22 2016 +0100
+++ b/js/core.js	Tue Oct 18 12:30:12 2016 +0100
@@ -3256,8 +3256,10 @@
                     break;
                 case "radio":
                     var child = this.parent.document.createElement('response');
-                    child.setAttribute('name', node.response.name);
-                    child.textContent = node.response.text;
+                    if (node.response !== null) {
+                        child.setAttribute('name', node.response.name);
+                        child.textContent = node.response.text;
+                    }
                     surveyresult.appendChild(child);
                     break;
                 case "checkbox":