DMXzone Calendar 2 Support Product Page
Calendar 2 date disappears on update record
Asked 01 Nov 2013 14:38:43
1
has this question
01 Nov 2013 14:38:43 Foster Brovan posted:
Hi,Calendar 2 when I go to update a record the date disappears.
I am using a PC windows vista with Dreamweaver 5.5
Here is my code:
<input class="dmxCalendar2" name="Article_date" id="Article_date" value="<?php echo dmxCalendarFormat($row_EditArticle['Article_date'], "mm/dd/yy") ; ?>" />
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(
function()
{
jQuery("#Article_date").dmxCalendar2(
{"defaultDate": "<?php echo dmxCalendarFormat($row_EditArticle['Article_date'], "mm/dd/yy") ; ?>", "altField": "hidden_Article_date", "altFormat": "yy-mm-dd", "numberOfMonths": [1, 2], "condDates": [], "firstDay": 1, "showOn": "both", "duration": "slow", "showOptions": {"direction": "up", "easing": "swing"}, "yearRange": "c-10:c+10"}
);
}
);
// ]]>
</script>Head code:
<?php
function dmxCalendarFormat($dt,$format) { //v1.01
if (!is_null($dt)) {
if ($dt != '') {
$strDate = is_numeric($dt) ? $dt : strtotime($dt);
$strRet = $format;
$strRet = preg_replace('/dd/i','d',$strRet);
$strRet = preg_replace('/mm/i','m',$strRet);
$strRet = preg_replace('/yy/i','Y',$strRet);
$strRet = preg_replace('/hh/i','H',$strRet);
$strRet = preg_replace('/nn/i','i',$strRet);
$strRet = preg_replace('/ss/i','s',$strRet);
return date($strRet,$strDate);
}
}
return '';
}
?>Thank you for your help.
Foster
Replies
Replied 01 Nov 2013 15:25:01
01 Nov 2013 15:25:01 Foster Brovan replied:
Found the Answer
I needed to go the the Advanced in Alternative Field.
Make a hidded field and the get the Initial Date.
This will set the date in the hidden feld.
Then when you update record the date will stay.
I needed to go the the Advanced in Alternative Field.
Make a hidded field and the get the Initial Date.
This will set the date in the hidden feld.
Then when you update record the date will stay.