29Jul/110
Conditional validation of shipping address using Zend sub forms
Zend Framework documentation gives you an excellent example on how to use sub forms. Sub forms let you split the logic of your application into smaller parts, validate it on demand and after collecting all the information validate the whole entity. Pretty cool huh? Lately I was implementing a shopping cart. In the last part of the check out process the user has to provide the billing address and shipping address. Usually they are the same but sometimes they differ. Here is how I solved the conditional validation of the form fields for orders where shipping address differs.