Closed ghost closed 7 years ago
Hello Dan,
Thanx for sharing! I am glad you were able to use this plugin and modify it to achieve your use case. I went ahead and updated the validation according to the changes with WPCF7. I also checked out the code you provided and couldn't get it to work on my end. I think this might be partly due to the fact that the code you shared is using deprecated classes, functions and other hooks.
Here's what I did to get your plugin to work with multiple fields. For some reason the validation wasn't working so I took a stab at correcting that as well.
Example Url: http://jgw899.webfactional.com (multipage submit wpcf7 customization)
1) ReWrite Validation using correct wpcf7 class. add_filter( 'wpcf7_validate_placesfieldtext', 'wpcf7_placesfieldtext_validation_overide', 99, 2 ); add_filter( 'wpcf7_validate_placesfieldtext*', 'wpcf7_placesfieldtext_validation_overide', 99, 2 );
function wpcf7_placesfieldtext_validation_overide($result, $tag) { $tag = new WPCF7_Shortcode($tag); if ($tag->type == 'placesfieldtext' || $tag->type == 'placesfieldtext*') { if (!isset($_POST[$tag->name]) || empty($_POST[$tag->name])) { $result->invalidate($tag, "Please type a location."); } } return $result; }
2) ReWrite javascript using native WP jQuery to support multiple fields:
add_action('wp_footer', function(){ $gpa_page = get_option( 'gpa_page' ); if( is_page( $gpa_page ) ) { ?>
<?php } }, 21);