Forums

Wrong date in the form loader

rastatom 10 Jun, 2011
Hi everybody,
Here is my problem...
When I load datas in a form, I have the date of the day in my date field...
...and I don't know why 🙄 😀 :mrgreen:
GreyHead 10 Jun, 2011
Hi Rastatom ,

There's an option for the datepicker that you can set to have it show an empty input allowEmpty: true

Bob
rastatom 14 Jun, 2011
Hi GreyHead,
I have try this option but it doesn't work... (in datepicker.js)
The date of the day is loaded in the fields, although there is another date in the database.
In phpmyadmin, the type of the field is "date" but when I saw in CF, the type of the field is "varchar"...
I don't know if it's the problem...
GreyHead 14 Jun, 2011
Hi Rastatom,

You can configure the DatePicker options in the DateTime Picker config box on the Form General Tab (click the Form Name link in the Forms Manager to see it).

I don't understand whay {PHPMyAdmin and CF would show different types for the same column; that sounds wrong. They are both reading the same data from the database.

Bob
rastatom 14 Jun, 2011
I think that datepicker is the problem....
Is it possible to put a datetime box in a form loader?
GreyHead 14 Jun, 2011
Hi rastatom,

Err . . . yes . . . but I'm not sure I understand the question any more?

Bob
rastatom 14 Jun, 2011
I try to explain better....
I don't find the way to load a date from my database in a Datepicker field.
It's load the date of the day (although there is another date in the database).
I put "allowEmpty: true" in "DateTime Picker selector" field but nothing different happen.
GreyHead 14 Jun, 2011
Hi rastatom,

If the database column is type = DATE then the inputOutputFormat need to match i.e.'Y-m-d'

If these match up then the ChronoForms republish or DB Load 'should' work OK.

Bob
rastatom 14 Jun, 2011
Hard to believe, but it doesn't work.
rastatom 15 Jun, 2011
Anyone have a solution for this problem?
Recorded date : 2011-06-30
Loaded date : 2011-06-14 (date of the day)😑
GreyHead 15 Jun, 2011
Hi Rastatom,

I've started to test this. So far all looks OK:[list]
  • I created a new form with just a date-time picker and a submit button. I used the default settings.

  • I created a table setting the date-picker column to type date.

  • I added a DB Save action to the form and linked it to my new table.

  • Checked that the form saves data to the table with the Y-m-d format. All OK.

  • Added a DB Record Loader action to the OnLoad event of the form and linked it to the same table. I set the DB Field and the Request Param both to 'cf_id' (the record id).

  • I load the form using the form URL plus &cf_id=2 and the date loads correctly.
    http://frances/Joomla1.6b/index.php?option=com_chronoforms&chronoform=test_form_4&cf_id=2

  • Saving the form from this URL updates the database to the amended date.

  • I add format: 'm/d/Y' to the DateTime Picker config box. The date now displays as e.g. 09/22/2012 but is still saved in the database table as 2012-09-22
  • [/list]
    So far all OK.
    [list]
  • I removed the entry from the DateTime Picker config box and dragged a Custom DatePicker action from the Utilities action group into the OnLoad event and moved it before the Show HTML action.

  • Added the class 'mydates' to the datepicker element and the Custom DatePicker action to link the two. Turned the time picker option off.

  • Check that the data format has returned to 'Y-m-d' and is still saving correctly. All OK.

  • Change the Display format to 'D d M y' and check that the date now displays as e.g. 'Fr 22 Jun 11'. The data is still saving correclty in the database in Y-m-d format.
  • [/list]
    I hope that this helps a bit.

    Bob
    rastatom 16 Jun, 2011
    Thanks a lot Bob !!!!!!

    The problem was from the type of the column...
    I have to put the type "DATETIME" and not "DATE".... 😶

    Can you do a last test for me? 😶

    1.Record a blank date (don't sectect a date, just press the submit button)
    2.Load this record in the form

    Does it load a date? For me, it's the date of the day.
    Max_admin 21 Jun, 2011
    Hi Rastatom,

    That's because the default setting for the date field is to load the same date of the day, you may override this by using a "Custom datepicker" action under the "Utilities" category, then you can select whether the field should be defaulted to empty or not.

    Regards,
    Max
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    rastatom 21 Jun, 2011
    Ok Max, I try this...
    Otherwise, I have put the type VARCHAR and the problem was solved.
    GreyHead 21 Jun, 2011
    Hi Rastatom,

    I suspect the problem with today's date appearing requires the allowEmpty: true option to be set. Otherwise when the input is empty - for any reason - the datepicker inserts today's date.

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