Reply To: Validate IBAN PHP

Home Forums Quform WordPress Validate IBAN PHP Reply To: Validate IBAN PHP

#32498
studio T
Participant

Hi Ally,

One more thing. I tried to implement the code

add_filter(‘quform_element_valid_5_37’, function ($valid, $value, Quform_Element_Field $element) { if (!preg_match(‘/^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$/’, $check)) {
return false;
}

$country = substr($check, 0, 2);
$checkInt = intval(substr($check, 2, 2));
$account = substr($check, 4);
$search = range(‘A’, ‘Z’);
$replace = [];
foreach (range(10, 35) as $tmp) {
$replace[] = strval($tmp);
}
$numStr = str_replace($search, $replace, $account . $country . ’00’);
$checksum = intval(substr($numStr, 0, 1));
$numStrLength = strlen($numStr);
for ($pos = 1; $pos < $numStrLength; $pos++) {
$checksum *= 10;
$checksum += intval(substr($numStr, $pos, 1));
$checksum %= 97;
}

return ((98 – $checksum) === $checkInt); { $element->addError(‘The value is not Foo’); $valid = false;
}

return $valid;
}, 10, 3);

Is this right?
My element unique ID is 5_37. This is my form link im trying to implement the IBAN validator.
https://studiot.agency/tennisfactory/termine/tennis-club-herrsching-e-v/
https://stackoverflow.com/questions/20983339/validate-iban-php/20983340#20983340

I need your pro experience 🙂
Best regards.

Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy