From ba56e34b6de6e57edb2b0db66ff3ca4e2081a7ea Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Sun, 19 Feb 2012 16:30:22 +0000 Subject: [PATCH] [ticket/10291] Fixed a bug in the quick reply AJAX. It wasn't submitting, as jQuery was ignoring the submit value. PHPBB3-10291 --- phpBB/assets/javascript/core.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index eb9798331e..bed25b5beb 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -251,7 +251,7 @@ phpbb.ajaxify = function(options) { elements.bind(event_name, function() { var action, method, data, that = this, $this = $(this); - if (!$this.attr('data-ajax')) + if ($this.find('input[type="submit"][data-clicked]').attr('data-ajax') === 'false') { return; } @@ -358,6 +358,15 @@ phpbb.ajaxify = function(options) { action = $this.attr('action').replace('&', '&'); data = $this.serializeArray(); method = $this.attr('method') || 'GET'; + + if ($this.find('input[type="submit"][data-clicked]')) + { + var submit = $this.find('input[type="submit"][data-clicked]'); + data.push({ + name: submit.attr('name'), + value: submit.val() + }); + } } else { @@ -386,6 +395,15 @@ phpbb.ajaxify = function(options) { return false; }); + if (is_form) { + elements.find('input:submit').click(function () { + var $this = $(this); + + $this.siblings('[data-clicked]').removeAttr('data-clicked'); + $this.attr('data-clicked', 'true'); + }); + } + return this; }