Home › Forums › Quform WordPress › Validate IBAN PHP
- This topic has 7 replies, 2 voices, and was last updated 3 years, 10 months ago by studio T.
- AuthorPosts
- January 20, 2021 at 2:45 pm #32462studio TParticipant
Is it posible to insert php to validate IBAN number on input?
Best regards,
MarkoJanuary 21, 2021 at 10:23 am #32465AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
January 29, 2021 at 1:49 pm #32491studio TParticipantHi Ally,
If I understood correctly with this code the input will check if the IBAN numbers are valid?
Despite having 22 characters the validator will recognize the numbers of account? Like on example with credit card.. I attach pic if you know what i mean.Best regards,
Marko- This reply was modified 3 years, 10 months ago by studio T.
Attachments:
You must be logged in to view attached files.January 31, 2021 at 9:05 pm #32498studio TParticipantHi 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#20983340I need your pro experience 🙂
Best regards.February 1, 2021 at 10:52 am #32499AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
February 1, 2021 at 11:19 am #32503studio TParticipantHi Ally,
It worked excellent! Thank you for your time.
One more thing. How to add to other forms that i have the same function?
There unique IDs are 4_37, 3_37, 6_37, 1_37
Same forms, different locations.Best regards.
Keep up with good work!February 1, 2021 at 11:32 am #32506AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
February 1, 2021 at 12:29 pm #32507studio TParticipantHi Ally,
Perfect! It worked.
Thank you once again.Best regards,
- AuthorPosts
- You must be logged in to reply to this topic.