Commit 5b216e36 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Make cancel buttons work after successful feedback submission


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 73100428
......@@ -4,11 +4,32 @@ function addFeedbackSuccess(form, data) {
addElementClass('add_feedback_form', 'hidden');
paginator.updateResults(data);
$('add_feedback_form_message').value = '';
rewriteCancelButtons();
}
function objectionSuccess() {
addElementClass('objection_form', 'hidden');
$('objection_form_message').value = '';
rewriteCancelButtons();
}
function rewriteCancelButtons() {
if ($('cancel_add_feedback_form_submit')) {
disconnectAll('cancel_add_feedback_form_submit');
connect('cancel_add_feedback_form_submit', 'onclick', function (e) {
e.stop();
addElementClass('add_feedback_form', 'hidden');
return false;
});
}
if ($('cancel_objection_form_submit')) {
disconnectAll('cancel_objection_form_submit');
connect('cancel_objection_form_submit', 'onclick', function (e) {
e.stop();
addElementClass('objection_form', 'hidden');
return false;
});
}
}
addLoadEvent(function () {
......@@ -36,11 +57,6 @@ addLoadEvent(function () {
return false;
});
}
connect('cancel_add_feedback_form_submit', 'onclick', function (e) {
e.stop();
addElementClass('add_feedback_form', 'hidden');
return false;
});
}
if ($('objection_form')) {
......@@ -55,13 +71,10 @@ addLoadEvent(function () {
return false;
});
}
connect('cancel_objection_form_submit', 'onclick', function (e) {
e.stop();
addElementClass('objection_form', 'hidden');
return false;
});
}
rewriteCancelButtons();
if ($('toggle_watchlist_link')) {
connect('toggle_watchlist_link', 'onclick', function (e) {
e.stop();
......
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