Disable Javascript VAT validation

Discussion in 'aMember Pro v.4' started by gogoseo, Jan 14, 2013.

  1. gogoseo

    gogoseo Member

    Joined:
    Nov 17, 2012
    Messages:
    36
    I want to disable the javascript VAT validation because it requires two country letters before the number that are not always needed in real life. I disabled the VAT validation in admin area, but the javascript "syntax" validation is still active. How to disable that?
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Sorry not sure I have understood, what validation do you mean and where exactly?
  3. gogoseo

    gogoseo Member

    Joined:
    Nov 17, 2012
    Messages:
    36
    There is a "VatId" filed in "Forms Editor"(maybe you have to enable EU Vat to get this...). If this field is placed on signup form, then there is a javascript validation in place for this field. I want it to go away:)
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Ok. Edit /amember/library/Am/Invoice/Tax.php find this class:
    class Am_Form_Brick_VatId extends Am_Form_Brick

    change this function :
    PHP:
        public function insertBrick(HTML_QuickForm2_Container $form)
        {
            
    $el $form->addText('tax_id')->setLabel(___("EU VAT Id (optional)"))
                ->
    addRule('regex''Invalid EU VAT Id format''/^[A-Za-z]{2}[a-zA-Z0-9\s]+$/');
            if (!
    $this->getConfig('dont_validate'))
                
    $el->addRule('callback2''-error-', array($this'validate'));
        }

    to
    PHP:
        public function insertBrick(HTML_QuickForm2_Container $form)
        {
            
    $el $form->addText('tax_id')->setLabel(___("EU VAT Id (optional)"));
            if (!
    $this->getConfig('dont_validate'))
                
    $el->addRule('callback2''-error-', array($this'validate'));
        }

  5. gogoseo

    gogoseo Member

    Joined:
    Nov 17, 2012
    Messages:
    36
    Thanks Alex. Its amazing how configurable amember is.
  6. gogoseo

    gogoseo Member

    Joined:
    Nov 17, 2012
    Messages:
    36
    How would i do the same for the "member Profile". The place in membership area where users can change their own informations. It seems the VAT "check" remained there...
  7. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    This shouldn't happen if you made above cstomization and use vatid brick in profile form. I have tested this on my local installation.
  8. gogoseo

    gogoseo Member

    Joined:
    Nov 17, 2012
    Messages:
    36
    Oh, you a right. I forgot to disable the validation for vatid inside admin area(for the profile form).

Share This Page