Commit c8344a8a by Jonathan Piacenti

Fix issue that prevented poll submission on first creation in studio.

parent eeb2ba85
...@@ -21,11 +21,13 @@ function PollUtil (runtime, element, pollType) { ...@@ -21,11 +21,13 @@ function PollUtil (runtime, element, pollType) {
this.pollInit = function(){ this.pollInit = function(){
// Initialization function for PollBlocks. // Initialization function for PollBlocks.
var selector = 'input[name=choice]:checked';
var radio = $('input[name=choice]:checked', element); var radio = $(selector, element);
self.submit.click(function () { self.submit.click(function () {
// Refresh. // We can't just use radio.selector here because the selector
radio = $(radio.selector, element); // is mangled if this is the first time this XBlock is added in
// studio.
radio = $(selector, element);
var choice = radio.val(); var choice = radio.val();
$.ajax({ $.ajax({
type: "POST", type: "POST",
...@@ -102,7 +104,6 @@ function PollUtil (runtime, element, pollType) { ...@@ -102,7 +104,6 @@ function PollUtil (runtime, element, pollType) {
url: self.tallyURL, url: self.tallyURL,
data: JSON.stringify({}), data: JSON.stringify({}),
success: function (data) { success: function (data) {
console.log(self);
$('div.poll-block', element).html(self.resultsTemplate(data)); $('div.poll-block', element).html(self.resultsTemplate(data));
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment