form 3.0 with calendar dateformat processed not correct

Hello,
I’ve created a 3.0 form, with a calendar (as in the demo). When I process this form, the date that is being processed has the wrong format:
9_!nativeeditor_status updated
9_order_created Fri Mar 25 2011 16:48:49 GMT+0100
9_order_description aangepast3
9_order_number_from_custo… wedwedwedwedefghj
ids 9

My MySQL database is not able to store a date formatted like this: Fri Mar 25 2011 16:48:49 GMT+0100

dateformat used: dateFormat: “%Y-%m-%d %H:%i:%s”
the date is showing correctly in the input field!
Any idea’s?
kind regards, Sitan

I’ve got the same problem! I’ve set the dateformat hardcoded in calander.js to:

dateformat:	'%Y-%m-%d'

but still SQL database receives dat in this format:

‘Mon March 07 2011 01:01:00’

I also noticed that when I load the form, and bind data to the calendarfields, the calendar fields contain no data. Other (normal) input fields are correctly filled with data stored in the database.
regards,
Sitan

Hello,

the problem is confirmed. We will fix it in the Suite 3.0. It is going to be released in early May.

If the fix is ready before the release, we’ll let you know.

Hi Alexandra,
thanks for your responce.
Are both problems confirmed? (dateformat and the binding problem) ?
Thanks,
Sitan

FIX

for the time beeing I’ve created a workaround for the problem :slight_smile:

$date_in = $_POST["calendar_date_value"]; $date_out = substr($date_in, 8, 2); $date_out .= substr($date_in, 4, 3); $date_out .= substr($date_in, 11, 4); $dateformatted = date('Y-m-d', strtotime($date_out)); //set 'Y-m-d' to your date field format in your sql database. You can also re-arrange the $date_out variable addition to make the strtotime understand what kind of format of datetime it is getting.

Hi Avanox,
this could be a solution if you handle the incomming data yourself, but I use the dataprocessor and then the date_out field could not be altered before storing it in the database.
regards, Sitan

Ok that’s a bit more complex indeed.

when POSTING the values you can indeed do with them what you want… (that’s why I use this functionality)

Time format fix for insert with dataprocessor:

function formatTime($action){
  $action->set_value("time",date("Y-m-d H:i:s", strtotime(substr($action->get_value("time"),0,24))));
}			

$gridConn->event->attach("beforeInsert", "formatTime");

Got solution made in pure JS, dirty but working… And - tested ONLY on v3… Here.

Hi all

New form version attached here
viewtopic.php?f=17&t=21793