Skip to content

Commit

Permalink
Allow to submit form after browser back button is pressed
Browse files Browse the repository at this point in the history
9f85120 added a check to prevent the form from being submitted
multiple times. This check is based on the presence of a class
that is added to the form when it is submitted the first time.

In some situations, the class is not removed from the form when the
user navigates back using the browser back button. This prevents the
form from being submitted again.

This commit adds a check to remove the class from the form when the
page is loaded.
  • Loading branch information
richieri-bps committed Sep 19, 2024
1 parent 6df44fa commit a92d752
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions share/static/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,11 @@ jQuery(function() {
form.addClass('rt-form-submitted');
});
});
// Clean up the class on page load in case user hit browser back button
// Listen for the back button event (popstate)
jQuery(window).on('popstate', function(event) {
jQuery('form').removeClass('rt-form-submitted');
});
});

function filterSearchResults (type) {
Expand Down

0 comments on commit a92d752

Please sign in to comment.