Hi Arne,
finally I had the time to look into the date format problem. As it turned out it is a shortcoming of a Joomla! core function which should be used by developers to create date controls. If you have a readonly date field, this functions always returns the format Y-m-d H:i:s which is exactly what you see.
Here is the solution which will be part of the next Visforms release and which you can integrate into the code of your Visforms installation right now if you want.
Open the file administrator/components/com_visforms/helpers/html/visforms.php
Find the following code (line 663)
Code:
public static function getDateControl($field) {
$date = JHTML::calendar($field->attribute_value, $field->name, 'field' . $field->id, $field->dateFormatJs, $field->attributeArray);
return $date;
}
Replace it with
Code:
public static function getDateControl($field) {
//Joomla date control for readonly fields has a fixed date format with time, we cannot use it in this case
if(isset($field->attributeArray['readonly']) && ($field->attributeArray['readonly'] == "readonly" || $field->attributeArray['readonly'] == 1 || $field->attributeArray['readonly'] === true))
{
if (is_array($field->attributeArray))
{
$attribs = JArrayHelper::toString($field->attributeArray);
$value = $field->attribute_value;
$name = $field->name;
$id = $field->id;
}
$date = '<input type="text" title="' . (0 !== (int) $value ? JHtml::_('date', $value, null, null) : '')
. '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '" ' . $attribs . ' />'
. '<input type="hidden" name="' . $name . '" id="' . $id . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '" />';
}
else
{
$date = JHTML::calendar($field->attribute_value, $field->name, 'field' . $field->id, $field->dateFormatJs, $field->attributeArray);
}
return $date;
}
I tested thoroughly but maybe you want to make a backup copy of the file first, just in case.
As Joomla! 3 has totally refactored the code of the core function, the date format of readonly date fields is correct in Visforms for Joomla! 3 without making changes.
Kind Regards,
Aicha