Last active
October 2, 2018 00:03
-
-
Save Shelob9/25073dc0ecde270af2b97c0868655f3f to your computer and use it in GitHub Desktop.
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
<?php | |
//Change error message of AJAX submitted form. | |
add_filter( 'caldera_forms_render_notices', function( $notices ){ | |
//Will NOT be set (during AJAX return) if there is no error | |
if( isset( $notices[ 'error' ], $notices[ 'error' ][ 'note' ] ) ){ | |
$notices[ 'error' ][ 'note' ] = 'Form could not be submitted, please correct erorrs or give us a call.'; | |
} | |
return $notices; | |
}); |
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
<?php | |
//Change error message of AJAX submitted form. | |
add_filter( 'caldera_forms_render_notices', function( $notices ){ | |
//Will ONLY be set (during AJAX return) if there is no error | |
if( isset( $notices[ 'error' ], $notices[ 'error' ][ 'sucess' ] ) ){ | |
$notices[ 'error' ][ 'sucess' ] = 'That was awesome!'; | |
} | |
return $notices; | |
}); |
I believe, there are typos. This worked for me:
add_filter( 'caldera_forms_render_notices', function( $notices ) {
if( isset( $notices[ 'success' ], $notices[ 'success' ][ 'note' ] ) ) {
$notices[ 'success' ][ 'note' ] = 'That was awesome!';
}
return $notices;
});
Note: success
(not "sucess") and the success text is accessed at $notices[ 'success' ][ 'note' ]
( "$notices[ 'error' ][ 'sucess' ]" )
Ref: https://calderaforms.com/doc/caldera_forms_render_notices/ should be updated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
This filter does not work at all.. Has no effect. Do you have any idea how I can change the success message dynamically?
Thanks,
Zoltan