This topic contains 1 reply, has 2 voices, and was last updated by Phil (Support) 6 years, 10 months ago.
-
Ticket
-
Hi
I am having some trouble with Contact Form 7’s error message.
I created duplicate check using “shortcodes, actions and filters”.
1234567891011121314151617181920212223242526272829function is_already_submitted($formName, $fieldName, $fieldValue) {require_once(ABSPATH . 'wp-content/plugins/contact-form-7-to-database-extension/CFDBFormIterator.php');$exp = new CFDBFormIterator();$atts = array();$atts['show'] = $fieldName;$atts['filter'] = "$fieldName=$fieldValue";$atts['unbuffered'] = 'true';$exp->export($formName, $atts);$found = false;while ($row = $exp->nextRow()) {$found = true;}return $found;}function my_validate_email($result, $tag) {$formName = 'Referral Gift Form'; // Change to name of the form containing this field$fieldName = 'dynamicname'; // Change to your form's unique field name$errorMessage = 'This reference number has already been used'; // Change to your error message$name = $tag['name'];if ($name == $fieldName) {if (is_already_submitted($formName, $fieldName, $_POST[$name])) {$result->invalidate($tag, $errorMessage);}}return $result;}add_filter('wpcf7_validate_dynamictext', 'my_validate_email', 10, 2);The error message does not want to display.
I am guessing something in the theme is overriding the error message.Can you please assist?
Any advice will be greatly appreciated.Kind regards
Madelein
Sorry, only verified customers can view ticket replies.