Field Date

beillard 15 Feb, 2010
Hi,

I can't save date field as "date", but omly as "text". I can't manage date function.

<input class="cf_datetime required" title="" size="20" id="dateEndProj" name="dateEndProj" type="text" />


Thanks for you help

André
GreyHead 15 Feb, 2010
Hi André,

You'll need to decode the input value from the 'd/m/y' or' m/d/y' format into 'YYYY-mm-dd'. A little snippet of PHp in the OnSubmit Before box shoudl do the trick.

Bob
beillard 15 Feb, 2010
Hi Bob,

Thanks for your help.

I tryed this code ( before email):
<?php
    JRequest::setVar('dateStartProj') = date('Y-m-d', strtotime(JRequest::getVar('dateStartProj'))); 
?>


And I got " Fatal error: Can't use function return value in write context in /var/www/postulant/components/com_chronocontact/libraries/customcode.php(64) : eval()'d code on line 2 "

Do you have any idea?

Best regards

André
GreyHead 15 Feb, 2010
Hi beillard.

The correct syntax is JRequest::setVar('name', 'value'); with no '='

You may find problems with strtotime too because of the ambiguities between d/m/y and m/d/y - runs a few checks to be sure that it's doing what you expect.

Bob
beillard 15 Feb, 2010
Grand merci

André
This topic is locked and no more replies can be posted.