What's the standard way to get rid of the three <select>
elements and allow users to just type dates in a regular <input type="text">
control?
Requirements include:
- Date format must be D/M/Y
- Existing dates must be printed correctly
- Cannot break date validation
I cannot find any reasonable documentation on this, just hacks in forum threads written by users as clueless as me xD
Clarification: Please note the CakePHP tag. I already know how to handle dates in regular PHP. I need help about the precise CakePHP mechanism I can use to adjust the framework's default functionality (and I really mean adjust rather than override).
So far, I've added this to the model:
public $validate = array(
'fecha' => array(
array(
'rule' => 'notEmpty',
'required' => true,
),
array(
'rule' => array('date', 'dmy'),
),
)
);
... and I've composed the field like this inside the view:
echo $this->Form->input(
'Foo.fecha',
array(
'type' => 'text',
)
);
... but all I can do with this is reading and validating user input: it won't print previous date properly and it won't store new date properly.