i've added some attributes for each user on my Magento installation. Each attribute is correctly showed in the registration fields, user can fill them, they're mandatory and they are also validated by Magento's javascript validation (followed the tutorial here : http://inchoo.net/magento/programming-magento/validate-your-input-magento-style/)

I need to validate also server side, i started creating a module following a tutorial online.

Every example that i've found overrided Magento's standard attributes. What should i override to validate my custom attributes? Which event should i catch? I'm a bit confused...

UPDATE : here is a zip file of my module https://www.dropbox.com/s/7nxjx6mh0hly6yn/MyModule.zip?dl=0. Let me know if you spot the error.


The validate() method of Mage_Customer_Model_Customer is called at multiple occations which are all not influencable with observers. Unfortunately the method itself hard-wires quite a few things, so if you want to change or extend customer validation, the most reliable way is to rewrite the customer model and override validate().

public function validate()
    $errors = parent::validate();
    if ($errors = true) { // means: "no errors" - don't ask!
        $errors = array();
    if (!my_custom_validation($this->getMyCustomAttribute()) {
        $errors[] = "That's invalid!";
    if (empty($errors)) {
        return true;
    return $errors;

You could try either

  1. Rewrite Mage_Customer_AccountController see Overriding Frontend Core Controllers


  1. Create an observer for customer_save_before

Then do your validation see Magento custom model with custom validation rules

<?xml version="1.0"?>

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.