compucorp / uk.co.compucorp.membershipextras

Membership Extras for CiviCRM
Other
5 stars 8 forks source link

CIWEMB-260: Prevent membership creation form multi submission #466

Closed omarabuhussein closed 1 year ago

omarabuhussein commented 1 year ago

Before

The same instance of the membership creation form can be submitted multiple times if the user clicks on the submit button more than once, which results in creating multiple memberships and contributions.:

dsasdasadsad

here you can see how the "Save" button is still available during the form submission:

2023-04-28 18_12_54-dsasdasadsad gif ‎- Photos

After

The same instance of the membership creation form can be submitted only once, which is achieved by disabling the form buttons after the user clicks on "Save":

32323232

here you can see how the "Save" button and the form buttons in general are now disabled during the form submission:

2023-04-28 18_09_33-32323232 gif ‎- Photos

Technical Details

I am using two differenet selectors for the form buttons which are:

.ui-dialog-buttonset button and .crm-submit-buttons button

the first is the selector that get used when opening the membership creation form through the a modal, when the 2nd is when it is opened in new tab or from "Memberships >> New Membership", given the form buttons markup is different in each case.