• We are available for any Development work:
  • Email us at: programmer_heart@yahoo.com

How to show Validation error as popups in Gravity Form in wordpress

To do this open your functions.php file and paste the following code:

<?php
add_filter( 'gform_validation_message', 'sw_gf_validation_message', 10, 2 );
function sw_gf_validation_message( $validation_message ) {
add_action( 'wp_footer', 'sw_gf_js_error' );
}
function sw_gf_js_error() { ?>
<script type="text/javascript">
alert( "Oops, you must have forgotten something...fields marked with a * are required!" );
</script>
<?php } ?>

You can change the error message by modifying what is inside the alert () function.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *

Press Enter to Search