comparison core.js @ 2015:302ae8a6ca53

Feature #1230: Popup content question entries now have automatic focus
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Mon, 01 Jun 2015 10:31:41 +0100
parents 57045ee30b64
children 4df1b4e7596f
comparison
equal deleted inserted replaced
2014:fdc795acf048 2015:302ae8a6ca53
106 var textArea = document.createElement('textarea'); 106 var textArea = document.createElement('textarea');
107 var br = document.createElement('br'); 107 var br = document.createElement('br');
108 this.popupContent.appendChild(span); 108 this.popupContent.appendChild(span);
109 this.popupContent.appendChild(br); 109 this.popupContent.appendChild(br);
110 this.popupContent.appendChild(textArea); 110 this.popupContent.appendChild(textArea);
111 this.popupContent.childNodes[2].focus();
111 } 112 }
112 this.popupContent.appendChild(this.popupButton); 113 this.popupContent.appendChild(this.popupButton);
113 } 114 };
114 115
115 this.initState = function(node) { 116 this.initState = function(node) {
116 //Call this with your preTest and postTest nodes when needed to 117 //Call this with your preTest and postTest nodes when needed to
117 // initialise the popup procedure. 118 // initialise the popup procedure.
118 this.popupOptions = $(node).children(); 119 this.popupOptions = $(node).children();
127 } 128 }
128 this.currentIndex = 0; 129 this.currentIndex = 0;
129 this.showPopup(); 130 this.showPopup();
130 this.postNode(); 131 this.postNode();
131 } 132 }
132 } 133 };
133 134
134 this.buttonClicked = function() { 135 this.buttonClicked = function() {
135 // Each time the popup button is clicked! 136 // Each time the popup button is clicked!
136 var node = this.popupOptions[this.currentIndex]; 137 var node = this.popupOptions[this.currentIndex];
137 if (node.nodeName == 'question') { 138 if (node.nodeName == 'question') {
168 } else { 169 } else {
169 testState.stateResults[testState.stateIndex].appendChild(this.responses); 170 testState.stateResults[testState.stateIndex].appendChild(this.responses);
170 } 171 }
171 advanceState(); 172 advanceState();
172 } 173 }
173 } 174 };
174 } 175 }
175 176
176 function advanceState() 177 function advanceState()
177 { 178 {
178 // Just for complete clarity 179 // Just for complete clarity