Example #1
0
 /**
  * Fix the registration number
  *
  * Transform out leading 0s and non numeric chars before processing input
  * This way if we remove everything there will still be ab error for required input being blank
  * @param array $arr
  * @return \Foundation\Form\Input or boolean
  */
 public function validateInput($arr)
 {
     $element = $this->_applicationPage->getPage()->getElementByFixedId(self::FID_REGISTRATION_NUMBER);
     $key = 'el' . $element->getId();
     $arr[$key] = preg_replace('#[^0-9]#', '', $arr[$key]);
     $arr[$key] = ltrim($arr[$key], '0');
     return parent::validateInput($arr);
 }