How can i validate the zip/postal code of the client in checkout, i have a function that test if the zip/postal code is valid but don't know how to integrate with ubercart.
thanks
|
Ubercart |
|
|
|
||
|
Thu, 12/27/2007 - 08:05
How can i validate the zip/postal code of the client in checkout, i have a function that test if the zip/postal code is valid but don't know how to integrate with ubercart. thanks
Re: Validate zip/postal code in checkout
As complicated as checkout panes are, they end up as nothing more than a very large form. With a little custom module you can implement hook_form_alter() on "uc_cart_checkout_form". The structure of the form goes something like this: $form['panes']['delivery']['delivery_postal_code']. The first "delivery" is the ID of the particular pane as defined in uc_cart_checkout_pane(). Everything after that is defined in the individual pane callback. The thing to do then is to add a "#validate" attribute to the appropriate fields which calls your function (or a wrapper so your module can translate the values appropriately) and returns true or false.
Hi,
I need something similar
Hi, I need something similar but not only validate zip code format. What I need is to test if shipping zip code is in a database (or a file) because I only want to ship to a defined geographic space. I use ubercart with drupal 5. Could you say me where can i find a function to do the test (or how to code it) and how to make a hook on uc-cart-checkout_form? Thanks |
|