Skip to content

Commit

Permalink
[PRJ-59] Disable invites submit button to prevent multiple form submi…
Browse files Browse the repository at this point in the history
…ssions
  • Loading branch information
annrra committed Jan 31, 2025
1 parent 54a2741 commit 5fa0dd6
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ window.bp = window.bp || {};

var isValid = true;
var $form = $( this );
var $submitButton = $form.closest( '#bb-rl-invite-modal' ).find( '#bb-rl-submit-invite' );

// Disable submit button to prevent multiple submissions
$submitButton.prop( 'disabled', true );

// Reset error classes
$form.removeClass( 'bb-rl-form-error' );
Expand Down Expand Up @@ -127,6 +131,7 @@ window.bp = window.bp || {};

if ( !isValid ) {
$form.addClass( 'bb-rl-form-error' );
$submitButton.prop( 'disabled', false );
return;
}

Expand All @@ -148,6 +153,9 @@ window.bp = window.bp || {};
},
error: function () {
bp.Readylaunch.Members.showToastMessage( bbReadyLaunchMembersVars.invite_error_notice, 'error', false );
},
complete: function () {
$submitButton.prop( 'disabled', false );
}
}
);
Expand Down

0 comments on commit 5fa0dd6

Please sign in to comment.