function grab() { parent::grab(); // strip out everything but numbers and decimal symbols $this->value = preg_replace('/[^\\d\\' . $this->decimal_symbol . ']/', '', $this->value); // complain if multiple decimal symbols if (!empty($this->value) && !is_numeric($this->value)) { $this->set_error('Please check the format of the amount you entered.'); } else { if (strpos($this->value, $this->decimal_symbol) !== false) { $this->value = sprintf('%.2F', $this->value); } } }