form->FormName(); $jsFunc =<<name');"; return <<name') $('$formID').validateNumericField('$this->name'); }else{ $('$formID').validateNumericField('$this->name'); } JS; } /** PHP Validation **/ function validate($validator){ if($this->value && !is_numeric($this->value)){ $validator->validationError( $this->name, sprintf( _t('NumericField.VALIDATION', "'%s' is not a number, only numbers can be accepted for this field"), $this->value ), "validation" ); return false; } else{ return true; } } function dataValue() { return (is_numeric($this->value)) ? $this->value : 0; } } ?>