diff --git a/field.class.php b/field.class.php index f761b96..7932001 100644 --- a/field.class.php +++ b/field.class.php @@ -1,38 +1,23 @@ field->param4) and !empty($data)) { - - /// Define the target - if (! empty($this->field->param5)) { - $target = 'target="'.$this->field->param5.'"'; - } else { - $target = ''; - } - - /// Create the link - $data = ''.htmlspecialchars($data).''; - } -*/ return $data; } function edit_field_add($mform) { /// Create the form field $mform->addElement('text', $this->inputname, format_string($this->field->name), 'maxlength="11" size="11"'); - $mform->setType($this->inputname, PARAM_INT); + $mform->setType($this->inputname, PARAM_TEXT); } function edit_validate_field($usernew) { @@ -40,6 +25,9 @@ class profile_field_cpf extends profile_field_base { $errors = array(); if (isset($usernew->{$this->inputname})) { $cpf = $usernew->{$this->inputname}; + if (ctype_digit($cpf)) { + return array($this->inputname => get_string('cpf_digits', 'profilefield_cpf')); + } if (strlen($cpf) != 11) { return array($this->inputname => get_string('cpf_size', 'profilefield_cpf')); } @@ -62,5 +50,3 @@ class profile_field_cpf extends profile_field_base { } } - - diff --git a/lang/en/profilefield_cpf.php b/lang/en/profilefield_cpf.php index 155f114..73853af 100644 --- a/lang/en/profilefield_cpf.php +++ b/lang/en/profilefield_cpf.php @@ -24,5 +24,6 @@ */ $string['pluginname'] = 'Brazilian CPF'; +$string['cpf_digits'] = 'CPF must have only numeric digits'; $string['cpf_size'] = 'CPF must have 11 digits'; $string['cpf_invalid'] = 'Invalid CPF';