Contact Form 7 + Contact Form 7 Datepicker + Custom validation - No custom error message [on hold]

I have created a form with CF7 and I inserted two date fields (with the CF7 datepicker plugin). The two fields are [date* date-641 date-format:mm/dd/yy], [date* date-820 date-format:mm/dd/yy]. The form is a booking form so I have to make some controls about the dates. date-641 is "CHECKIN" date and date-820 is "CHECKOUT"

I have created this:

add_filter('wpcf7_validate_date','custom_date_confirmation_validation_filter', 10, 2 );  function custom_date_confirmation_validation_filter( $result, $tag ) {  $tag = new WPCF7_Shortcode( $tag ); $date1 = $_POST['date-641']; $date2 = $_POST['date-820']; $error_msg = 'Invalid date'; if ($date2 < $date1){ $result->invalidate( 'date-820', $error_msg); //I used $tag instead of 'date-820' with the same results   }  return $result;   } 

The control works fine but the error message I get is not the one I set in $error_msg, it is the generic "One or more fields have an error. Please check and try again." What am I doing wrong?


Category: plugin contact form 7 Time: 2016-07-28 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 1.288 (s). 13 q(s)