Skip to content

Commit

Permalink
Send poll options on preview
Browse files Browse the repository at this point in the history
Send the poll options when previewing, to avoid
an error message about missing poll options.

Fixes SimpleMachines#5792

Signed-off-by: Oscar Rydhé oscar.rydhe@gmail.com
  • Loading branch information
SGA-oscar-rydhe committed Nov 27, 2020
1 parent 40a81b1 commit 1038fba
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Themes/default/scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1831,7 +1831,7 @@ smc_preview_post.prototype.doPreviewPost = function (event)
var new_replies = new Array();
if (window.XMLHttpRequest)
{
// @todo Currently not sending poll options and option checkboxes.
// @todo Currently not sending option checkboxes.
var x = new Array();
var textFields = ['subject', this.opts.sPostBoxContainerID, this.opts.sSessionVar, 'icon', 'guestname', 'email', 'evtitle', 'question', 'topic'];
var numericFields = [
Expand Down Expand Up @@ -1871,6 +1871,15 @@ smc_preview_post.prototype.doPreviewPost = function (event)
if (checkboxFields[i] in document.forms.postmodify && document.forms.postmodify.elements[checkboxFields[i]].checked)
x[x.length] = checkboxFields[i] + '=' + document.forms.postmodify.elements[checkboxFields[i]].value;

// Poll options.
var i = 0;
while ('options[' + i + ']' in document.forms.postmodify)
{
x[x.length] = 'options[' + i + ']=' +
document.forms.postmodify.elements['options[' + i + ']'].value.php_to8bit().php_urlencode();
i++;
}

sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + 'action=post2' + (this.opts.iCurrentBoard ? ';board=' + this.opts.iCurrentBoard : '') + (this.opts.bMakePoll ? ';poll' : '') + ';preview;xml', x.join('&'), this.onDocSent.bind(this));

document.getElementById(this.opts.sPreviewSectionContainerID).style.display = '';
Expand Down

0 comments on commit 1038fba

Please sign in to comment.