Bugzilla – Attachment 105173 Details for
Bug 25563
Cannot submit "add order from MARC file" form after alert
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25563: (bug 24386 follow-up) Don't disable submit button if form has not been submitted yet
Bug-25563-bug-24386-follow-up-Dont-disable-submit-.patch (text/plain), 3.39 KB, created by
Nick Clemens (kidclamp)
on 2020-05-21 10:17:39 UTC
(
hide
)
Description:
Bug 25563: (bug 24386 follow-up) Don't disable submit button if form has not been submitted yet
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-05-21 10:17:39 UTC
Size:
3.39 KB
patch
obsolete
>From 413e86bec3f4d468dc31d5768f5820973e2f20f8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 21 May 2020 12:00:34 +0200 >Subject: [PATCH] Bug 25563: (bug 24386 follow-up) Don't disable submit button > if form has not been submitted yet > >On bug 24386 we prevent double form submission using the our own preventDoubleFormSubmit JS function. > >The problem is that we are checking some conditions, and prevent the >form submission if something is not filled (for instance no checkbox >checked, or no fund selected). > >Technically it means that: >- click the submit button >- it submits the form >- we disable the submit button >- we prevent the form to be submitted before something is wrong >At this stage the button is disabled and the form cannot be longer be >submitted. > >This patch replaces the "on submit" event of the form with the "on click" event of the submit button. >Which means we are going to: >- click the submit button >- we prevent the form to be submitted before something is wrong >=> The button will only be disabled if the form is really submitted > >Test plan: >- stage a marc record >- acquisitions: have a basket >- click on "Add to basket" >- "From a staged file" >- Don't tick the record >- Save >- You should see an expected error message >- Tick the record >- Save >- You should see an expected error message >- Choose a fund >- Click the "Save" button as many times as you can, to try double submit >it. >=> The order is saved > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt | 2 +- > koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js | 8 ++++++-- > 2 files changed, 7 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >index 80d6cba40c..a522f70c79 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >@@ -379,7 +379,7 @@ > </div> > > <fieldset class="action"> >- <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Cancel</a> >+ <input id="add_order" type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Cancel</a> > </fieldset> > </form> > [% ELSE %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js b/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js >index 5c10241769..8382532a64 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js >@@ -48,7 +48,9 @@ $(document).ready(function() { > return false; > }); > >- $("#Aform").on("submit", function(){ >+ $("input#add_order").on("click", function(e){ >+ e.preventDefault(); >+ > if ( $("input:checkbox[name='import_record_id']:checked").length < 1 ) { > alert( ERR_NO_RECORD_SELECTED ); > return false; >@@ -72,7 +74,9 @@ $(document).ready(function() { > return false; > } > >- return disableUnchecked($(this)); >+ disableUnchecked($(this.form)); >+ >+ $(this.form).submit(); > }); > > $('#tabs').tabs(); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25563
:
105171
|
105172
|
105173
|
105183