Skip to content

Commit

Permalink
fix(question): show error toast when editing a question fails
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Nov 29, 2021
1 parent d81b763 commit d90c3f9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 0 additions & 2 deletions ajax/question_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@

$success = $question->update($_REQUEST);
if (!$success) {
echo array_shift($_SESSION['MESSAGE_AFTER_REDIRECT'][ERROR]);
unset($_SESSION['MESSAGE_AFTER_REDIRECT'][ERROR]);
http_response_code(500);
exit();
}
Expand Down
3 changes: 1 addition & 2 deletions js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,7 @@ var plugin_formcreator = new function() {
data: form.serializeArray(),
dataType: 'html'
}).fail(function(data) {
$('#plugin_formcreator_error').text(data.responseText);
$('#plugin_formcreator_error').show();
displayAjaxMessageAfterRedirect();
}).done(function(data) {
var question = $('.plugin_formcreator_form_design[data-itemtype="PluginFormcreatorForm"] [data-itemtype="PluginFormcreatorQuestion"][data-id="' + questionId + '"]');
question.find('[data-field="name"]').text(data)
Expand Down

0 comments on commit d90c3f9

Please sign in to comment.