Forums

Saving date from datetimepicker?

rmesman 08 Mar, 2009
Hi,

Ok, I admit, I make forms without the (very usefull) wizard (I'm used to work with notepad2...) but this also gives me some disadvantages;

I want to use a date-input and I read about the nice datetimepicker which is available in the form-wizard!

I quickly made a simple test-form using the wizard and put in a date-input field.
I looked at all the tabs of this test-form and noticed the following required:
- General tab: load CSS:yes, date-format: d/m/Y
- Form-code: using <input class="cf_datetime" type="text" name="datum" id="datum" etc.etc....
- Autogenerated -code: Form Fields Names: ..., datum, ....; Form Fields types: ...., text, .....; Date Fields names: datum

I applied all of this in my hand-made form and saw the datepicker nicely showing up on my form and putting in the date in the requested format m/d/Y.
The data is stored into a table where this formfield is stored in a date-field. Only the datefield is in the format Y-m-d, so no date is being stored.

How to solve this little hick-up:
Save the date into a text-field? Convert the date formfield before submit to the table?

Thnx, Robin
GreyHead 09 Mar, 2009
Hi Robin,

Yes dion's solution will work, you can also do it in the form using a little JavaScript snippet to re-format the date and save to to a hidden field; then save the hidden field.

I might work this up later it could be useful for several things.

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