WebsiteBaker Support (2.8.x) > Bakery Shop
Address form field not required?
mgeene:
Hello,
Is it possible in the form where you must enter the delivery address that the telephone field is not required?
Thanks for your comment!
marmot:
Hi,
if you are using bakery 1.6 read (maybe let google translate) this.
If you are using bakery 1.7 find in save_form.php line 34 and change to:
--- Code: --- if ($field != 'cust_tax_no' && $field != 'cust_phone' && (strpos($field, 'company') === false)) {
--- End code ---
and delete or comment lines 139 - 144:
--- Code: --- /*if (strpos($field, 'phone') !== false) {
if (!preg_match('#^[0-9)(xX +.-]{7,20}$#', $value)) {
$error_bg[] = $field;
$errors[] = htmlspecialchars($value, ENT_QUOTES).' '.$MOD_BAKERY['ERR_INVAL_PHONE'];
}
}*/
--- End code ---
regards
mgeene:
Hi,
THANKS! Thats it!
seanie_morris:
Hey there,
I've been pulling my hair out trying to replicate this but with a different field or fields. Take 'zip' or 'first_name' for examples, how would I make this work? I've tried so many combinations, even deleting or commenting the required section code further down (as was demonstrated in the phone field above) but I still get prompted about empty fields.
I had started a new post here:
http://forum.WebsiteBaker.org/index.php/topic,28630.0.html
but a search for something else turned up this older thread (which didn't come up on a search yesterday for me!)
Thanks in advance,
Seanie.
seanie_morris:
((Using bakery 1.78, up from the previously mentioned 1.7 earlier in this thread))
I am chasing this up as I was never able to get the right code by trial and error, and it has come up for me again.
The following are accepted if the fields are left blank:
Line 42:
--- Code: ---if ($field != 'cust_tax_no' && (strpos($field, 'company') === false)) {
--- End code ---
How do I let 'zip' be accepted as well?
From the example in this thread, I changed line 42 to:
--- Code: ---if ($field != 'cust_tax_no' && $field != 'zip' && (strpos($field, 'company') === false)) {
--- End code ---
and then commented line 159 as follows:
--- Code: ---/*if (strpos($field, 'zip') !== false) {
if (!preg_match('#^[A-Za-z0-9\s\-]{4,10}$#u', $value)) {
$error_bg[] = $field;
$errors[] = htmlspecialchars($value, ENT_QUOTES).' '.$MOD_BAKERY['ERR_INVAL_ZIP'];
}
}*/
--- End code ---
But I get errors that then will not display the form, so I have to undo all changes to get it back again.
Seanie.
Navigation
[0] Message Index
[#] Next page
Go to full version