Alright so I've come up with the following:
in _Install.php:
$field = array('name'=>'Test Date', 'type'=>'text', 'required'=>false, 'param'=>'20', 'visible'=>true,
'display_callback'=>array('Insurance_PolisaCommon', 'display_test_date'),
'QFfield_callback'=>array('Insurance_PolisaCommon', 'QFfield_test_date'),
);
Utils_RecordBrowserCommon::new_record_field('insurance_polisa', $field);
In _Common_0.php:
public function QFfield_test_date(&$form, $field, $label, $mode, $default) {
if ($mode=='add' || $mode=='edit') {
$record_set = "polisa";
$form->addElement('date', $field, $label, array('language'=> 'en','format' => 'MY',));
if ($mode=='edit') $form->setDefaults(array($field=>$default));
} else {
$form->addElement('static', $field, $label);
$form->setDefaults(array($field=>$default));
}
}
public static function display_test_date($v, $nolink=false) {
return Utils_RecordBrowserCommon::create_linked_label_r('insurance_polisa', 'Test Date', $v, $nolink);
}
It's semi-working.
The problems are:
1. It shows up an Array text after the record is saved
2. The chosen month/year isn't actually saved (or at least it's not showing it but rather some default month/year)
On a side note...
Is there a better way of showing up the month/year choosing except for the 2 selectboxes?
Thanks.
Regards,
Liran.