I create custom module and would like to validate the input fields such date.
I tried in Form.php
public function _prepareForm()
{
$form = new Varien_Data_Form(array(
'id' => 'edit_form',
'method' => 'post'
));
$f = $form->addFieldset('User', array(
'legend' => 'Add User',
'class' => 'fieldset-wide'
));
$f->addField('to', 'date', array(
'name' => 'to',
'label' => 'Date to',
'format' => 'DD-MM-YYYY',
'class' => 'validate-date',
'required' => true
));
}
But the class is not added, and nothing does it.
What am I doing wrong?
Best Answer
Try
validate_class
, notclass
look at
Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Related
as an example.