<?php

/**
 * SimpleForm2
 *
 * @package SimpleForm2
 * @author ZyX (allforjoomla.ru)
 * @copyright (C) 2010-2017 by ZyX (http://www.allforjoomla.ru)
 * @license: http://www.allforjoomla.ru/license
 *
 * */
defined('_JEXEC') or die(':)');

class simpleForm2Element_Number extends simpleForm2Element_Text {

    public function validate() {
        if(!parent::validate()){
            return false;
        }
        if(!empty($this->inputValue) && !is_numeric($this->inputValue)){
            $this->setError(JText::_('MOD_SIMPLEFORM2_VALUE_IS_NOT_A_NUMBER'));
            return false;
        }
        return true;
    }

}
