-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lock Application During Update_And_Advance (#996)
## Description of change [Provider: Fast Submit Clicks Can Wrongly Create Multiple Records](https://dsdmoj.atlassian.net/browse/CRM457-1746) ## Notes for reviewer - Lock current_application when update_and_advance method in BaseStepController is handling attempting to update records - Disable all submit buttons associated with a form when the form is being submitted
- Loading branch information
Showing
8 changed files
with
51 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import $ from 'jquery' | ||
|
||
window.$ = $ | ||
|
||
$(function() { | ||
$('button[type="submit"]').on("click", function(e) { | ||
e.preventDefault() | ||
let form = $(this).closest("form") | ||
let formButtons = form.find('button[type="submit"]') | ||
formButtons.each(function(){ | ||
$(this).attr("disabled", true) | ||
}) | ||
|
||
/* | ||
this code ensures the button's submission type is appended to params | ||
so that the BaseStepController still has this available to know | ||
whether the form should commit_draft/save_and_refresh/reload | ||
*/ | ||
let buttonAction = $(this).attr("name") | ||
if(buttonAction){ | ||
form.append(`<input type="hidden" name="${buttonAction}" value="" >`) | ||
} | ||
|
||
form.trigger('submit.rails') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters