1

It looks like Expresso store during the checkout process allows to use disallowed characters in postal code and city fields for shipping. Also postal code allows to put only 2 characters when shorter in the world is 3 digits. It creates problems when UPS or FedEx modules are used for shipping calculation.

Any clue how to limit postal code when shipping is only in the States and validate city name if doesn't contains numbers etc?

Thanks

1

There are a couple of ways that you can validate your fields. You could use HTML5 validators such as number for zip codes. Something along the lines of

<input type="number" name="billing_postcode" maxlength="5" minlength="5" >

Personally though I prefer using the CodeIgniter Styled Validation Rules:

{exp:store:checkout
 rules:billing_postcode="required|numeric|min_length[5]|max_length[5]"
 rules:billing_city="min_length[3]|alpha"
 rules:phone="numeric" {!-- this would be applied to both shipping and billing fields --}
}

(Store documentation on Rules.)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.