Ok, I have a table with 2 columns(column_type, column_value) as following:
column_type enum('number', 'percentage', 'currency', 'date', 'text'),
column_value varchar(64);
The type of value of column_value depends on the value of
column_type. For example, there is a record with 'number' in
column_type, the value of
column_value should be a number, even if it's stored as varchar. Same as for 'percentage' and 'currency'.
However, if the value of
column_type is 'date', the value of
column_value should look like '01/09/2012'. What I would like to do is to populate the calendar picker right next to the field 'column_value', if the value of
column_type is 'date'. Therefore, create the widget for the
column_value like:
- Code: Select all
function block__column_value_widget() {
$app =& Dataface_Application::getInstance();
$record = $app->getRecord();
echo '<input type="text" name="column_value" id="column_value" value="' . $record->val('column_value') . "' />
if ($record->val('column_type') == 'date') {
echo 'calendar picker is displayed here';
}
}
So what is the javascript for the calendar picker or how do I accomplish the same goal as above you way?