Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('sln.shortcode.details.dispatchForm.validate_bind_values', function ($isValid, $values, $step) {
- if (isset($values['codice_fiscale'])) {
- $codiceFiscale = $values['codice_fiscale'];
- $pattern = "/^[A-Za-z]{6}[0-9LMNPQRSTUV]{2}[A-Za-z]{1}[0-9LMNPQRSTUV]{2}[A-Za-z]{1}[0-9LMNPQRSTUV]{3}[A-Za-z]{1}$/i";
- if (strlen($codiceFiscale) !== 16 || !preg_match($pattern, $codiceFiscale)) {
- $step->addError(__('Codice fiscale errato', 'salon-booking-system'));
- $isValid = false;
- }
- }
- return $isValid;
- }, 10, 3);
Add Comment
Please, Sign In to add comment