Formularios
Versión 1 (Guillermo Zdanowicz, 26/08/2011 21:41)
| 1 | 1 | Guillermo Zdanowicz | h1. Formularios |
|---|---|---|---|
| 2 | 1 | Guillermo Zdanowicz | |
| 3 | 1 | Guillermo Zdanowicz | |
| 4 | 1 | Guillermo Zdanowicz | Ejemplo de sentencias en el form |
| 5 | 1 | Guillermo Zdanowicz | |
| 6 | 1 | Guillermo Zdanowicz | class AreasForm extends BaseAreasForm |
| 7 | 1 | Guillermo Zdanowicz | { |
| 8 | 1 | Guillermo Zdanowicz | public function configure() |
| 9 | 1 | Guillermo Zdanowicz | { |
| 10 | 1 | Guillermo Zdanowicz | |
| 11 | 1 | Guillermo Zdanowicz | parent::setup(); |
| 12 | 1 | Guillermo Zdanowicz | |
| 13 | 1 | Guillermo Zdanowicz | unset($this['created_at'],$this['updated_at']); // quita estos campos para que no se visualicen en el formulario |
| 14 | 1 | Guillermo Zdanowicz | |
| 15 | 1 | Guillermo Zdanowicz | //formato de los campos fecha |
| 16 | 1 | Guillermo Zdanowicz | b$format = '%day%/%month%/%year%'; |
| 17 | 1 | Guillermo Zdanowicz | //define el rango de campo fecha |
| 18 | 1 | Guillermo Zdanowicz | $range = range(date('Y')-90, date('Y')-15); |
| 19 | 1 | Guillermo Zdanowicz | $years = array_combine($range,$range); |
| 20 | 1 | Guillermo Zdanowicz | // setea la condifuracion de campo fecha en el campo del formulario |
| 21 | 1 | Guillermo Zdanowicz | $this->widgetSchema['fechanac'] = new sfWidgetFormDate(array('years' => $years, 'format' => $format )); |
| 22 | 1 | Guillermo Zdanowicz | } |
| 23 | 1 | Guillermo Zdanowicz | |
| 24 | 1 | Guillermo Zdanowicz | } |