WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Bakery Shop => Topic started by: Broem on September 21, 2016, 08:15:26 AM

Title: Company field not allowing a . (dot)
Post by: Broem on September 21, 2016, 08:15:26 AM
Here in The Netherlands some company's have a . (dot) in the name. Like B.V. (the kind of firm). Now the Bakery shop checks the Company field (when enabled) for a .

I did see a topic about the address preg_match and think it is something similar for the company field, but not sure what preg_match it should be to allow a . (dot) in the field. Found it should be somewhere in the save_form.php file.
Title: Re: Company field not allowing a . (dot)
Post by: freeSbee on September 21, 2016, 10:03:26 AM
Hi Broem

Go to the file save_form.php about lines 93-98:
Code: [Select]
if (strpos($field, 'company') !== false) {
if (!preg_match('#^[\p{Latin}'.$us.'0-9+&\s\-]{0,50}$#u', $value)) {
$error_bg[] = $field;
$errors[]   = htmlspecialchars($value, ENT_QUOTES).' '.$MOD_BAKERY['ERR_INVAL_NAME'];
}
}

… and replace the code above by
Code: [Select]
if (strpos($field, 'company') !== false) {
if (!preg_match('#^[\p{Latin}'.$us.'0-9.+&\s\-]{0,50}$#u', $value)) {
$error_bg[] = $field;
$errors[]   = htmlspecialchars($value, ENT_QUOTES).' '.$MOD_BAKERY['ERR_INVAL_NAME'];
}
}

Regards Christoph
Title: Re: Company field not allowing a . (dot)
Post by: Broem on September 21, 2016, 04:22:48 PM
Thanks, this solved the issue :)