Quantcast
Channel: WordPress.org Forums » [Forminator Forms – Contact Form, Payment Form & Custom Form Builder] Support
Viewing all articles
Browse latest Browse all 1461

Create a custom error message no longer works

$
0
0

Replies: 0

Hello

this code doesn’t work anymore

Can you help me?

<?php

/**

  • Create a custom error message
    */

add_filter(‘forminator_custom_form_submit_errors’, ‘my_custom_form_validation’, 10, 3);

function my_custom_form_validation($submit_errors, $form_id, $field_data_array) {

// Skip if is not the correct form
if((int)$form_id !== 235465){
return;
}
$num1 = (int) $_POST[‘number-6’];
$num2 = (int) $_POST[‘number-7’];
$num3 = (int) $_POST[‘number-5’];
$num4 = (int) $_POST[‘number-4’];
$num9 = (int) $_POST[‘number-9’];
$num10 = (int) $_POST[‘number-10’];
$num11 = (int) $_POST[‘number-11’];
$num12 = (int) $_POST[‘number-12’];

// Custom error if ID already submited
if($num1 + $num2 + $num3!= 6 && $num4>0){
$submit_errors[][ ‘number-6’] = ( ‘Le total doit être égal à 6Kg, Merci de modifier vos quantités’ ); $submit_errors[][ ‘number-7’] = ( ‘Le total doit être égal à 6Kg, Merci de modifier vos quantités’ );
$submit_errors[][ ‘number-5’] = __( ‘Le total doit être égal à 6Kg, Merci de modifier vos quantités’ );
}

// Custom error if ID already submited
if($num10 + $num11 + $num12!= 3 && $num9>0){
$submit_errors[][ ‘number-10’] = ( ‘Le total doit être égal à 3Kg, Merci de modifier vos quantités’ ); $submit_errors[][ ‘number-11’] = ( ‘Le total doit être égal à 3Kg, Merci de modifier vos quantités’ );
$submit_errors[][ ‘number-12’] = __( ‘Le total doit être égal à 3Kg, Merci de modifier vos quantités’ );
}

// Always return $submit_errors
return $submit_errors;

}


Viewing all articles
Browse latest Browse all 1461

Trending Articles