Reputation: 13
Does anyone know how to change cf7 alert message when the input value is greater than 10?
If input value = 11 or up change the cf 7 alert message after submitting it.
Thanks for your help.
Upvotes: 1
Views: 720
Reputation: 5639
You could hook into the before_send_mail
and update the message based on a specific field.
add_action ('wpcf7_before_send_mail', 'dd_before_send_mail');
function dd_before_send_mail($contact_form){
// Get the instance
$submission = WPCF7_Submission :: get_instance();
if ($submission){
$fields = $submission->get_posted_data();
// put your field name in for [your-field]
if (intval($fields['your-field'] ) > 10 ) {
$contact_form -> set_properties(array('messages' => array('mail_sent_ok' => 'This is your message')));
}
}
}
Upvotes: 1