| @@ 5-23 (lines=19) @@ | ||
| 2 | ||
| 3 | namespace hemio\form; |
|
| 4 | ||
| 5 | class FieldCheckbox extends Abstract_\FormFieldInput |
|
| 6 | { |
|
| 7 | ||
| 8 | public function getInputType() |
|
| 9 | { |
|
| 10 | return 'checkbox'; |
|
| 11 | } |
|
| 12 | ||
| 13 | /** |
|
| 14 | * |
|
| 15 | * @param boolean $required |
|
| 16 | */ |
|
| 17 | public function setRequired($required = true) |
|
| 18 | { |
|
| 19 | $this->addValidityCheck(new CheckMinLength(1)); |
|
| 20 | $this->required = $required; |
|
| 21 | $this->getControlElement()->setAttribute('required', (boolean) $required); |
|
| 22 | } |
|
| 23 | } |
|
| 24 | ||
| @@ 5-30 (lines=26) @@ | ||
| 2 | ||
| 3 | namespace hemio\form; |
|
| 4 | ||
| 5 | class FieldPassword extends Abstract_\FormFieldInput { |
|
| 6 | ||
| 7 | public function getInputType() { |
|
| 8 | return 'password'; |
|
| 9 | } |
|
| 10 | ||
| 11 | // force the value atribute to null to prevent resending the password to clients |
|
| 12 | public function getValueStored() { |
|
| 13 | return ''; |
|
| 14 | } |
|
| 15 | ||
| 16 | public function getValueToUse() { |
|
| 17 | return ''; |
|
| 18 | } |
|
| 19 | ||
| 20 | /** |
|
| 21 | * |
|
| 22 | * @param boolean $required |
|
| 23 | */ |
|
| 24 | public function setRequired($required = true) { |
|
| 25 | $this->addValidityCheck(new CheckMinLength(1)); |
|
| 26 | $this->required = $required; |
|
| 27 | $this->getControlElement()->setAttribute('required', (boolean) $required); |
|
| 28 | } |
|
| 29 | ||
| 30 | } |
|
| 31 | ||