Bug 29773 - suggestion.pl event listener too restrictive
Summary: suggestion.pl event listener too restrictive
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-27 19:13 UTC by Christopher Brannon
Modified: 2021-12-27 19:13 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Brannon 2021-12-27 19:13:19 UTC
Suggestion.pl has an event listener that is listening to all buttons of the type submit, which requires the user to select at least one suggestion on the page.  This prevents other buttons of a submit type that have nothing to do with that particular form from being added to the page and working without this same restriction.

$("button[type='submit']").on("click", function(e) {
                    var submit_button = this;
                    var form = $(submit_button).parents("form");
                    var action = $(submit_button).val();
                    var selected_suggestions = $(form).find("input[name='suggestionid']:checked");
                    if ( selected_suggestions.length == 0 ) {
                        alert(_("Please select at least one suggestion"));
                        e.preventDefault();
                        return false;
                    }

needs to be rewritten so that it is limited to the 4 buttons at the bottom of the page only.