Skip to content

Commit

Permalink
use the warning class for form submissions messages
Browse files Browse the repository at this point in the history
  • Loading branch information
cjyabraham committed May 22, 2020
1 parent 143d2eb commit 0048f43
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions web/wp-content/themes/lfevents/src/assets/js/sfmc-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ function onSubmit(token) {
data: f.serialize(),
beforeSend: function() {
$( "#sfmc-form" ).toggle();
$( "#message" ).html( "Thank you for your submission. Your request is being processed..." ).addClass( "callout primary" );
$( "#message" ).html( "Thank you for your submission. Your request is being processed..." ).addClass( "callout warning" );
message.scrollIntoView( { behavior: "smooth", block: 'center' } );
},
success: function(data) {
var msg = $( data ).find( "p" ).text();
if ( msg.includes( "Error" ) ) {
$( "#message" ).html( msg ).removeClass( "primary" ).addClass( "alert" );
$( "#message" ).html( msg ).removeClass( "warning" ).addClass( "alert" );
} else {
$( "#message" ).html( msg ).removeClass( "primary" ).addClass( "success" );
$( "#message" ).html( msg ).removeClass( "warning" ).addClass( "success" );
}
message.scrollIntoView( { behavior: "smooth", block: 'center' } );
},
error: function(xhr, status, error) {
var errorMessage = xhr.status + ': ' + xhr.statusText;
$( "#message" ).html( "There was an error processing your submission. Please try again or contact us directly at [email protected].<br>(" + errorMessage + ")" ).removeClass( "primary" ).addClass( "alert" );
$( "#message" ).html( "There was an error processing your submission. Please try again or contact us directly at [email protected].<br>(" + errorMessage + ")" ).removeClass( "warning" ).addClass( "alert" );
message.scrollIntoView( { behavior: "smooth", block: 'center' } );
}
}
Expand Down

0 comments on commit 0048f43

Please sign in to comment.