Hello Everybody,
i have a problem adding and editing database entries with date / datetime fields.
Configuration:
Joomla 4.3.2
PHP 8.1.19
ChronoForms7 7.0.10
MySQL 5.7.41
I have to say, that the problem was not present with my old configuration (Joomla 3.10.11, PHP7.4, ChronoForms 7.0.10), every form worked until the upgrade to J4 and PHP8.
What happens:
- I insert entries into my DB vie a form and use the same form for editing. Testing with a simple form only containing some fields for create date and modified date for example plus 1 text field and one calender field.
- Trieed date or datetime as data format in the database.
- Default value for the date field is NULL or 0000-00-00
- When I add a database entry in PHPMyAdmin the default value is written (0000-00-00 or the field is NULL).
- When I add or modify an entry with Chronforms with a random date (e.g. 2023-06-07), everything works.
First Problem:
- Opening an existing entry with Chronoforms with the value 0000-00-00 shows 2001-01-01 and I have to klick a lot until the correct date.
Second Problem:
- Deleting an existing date value (empty field) or adding a record withou a selected date brings the error:
"22007 - 22007, 1292, Incorrect date value: '' for column 'test_date' at row 1"
(a similar problem was described with empty id, I had the same with the id and have to set it manually to 0 on insert although the database is set correct)
- When I try to write NULL, the same error occurs.
- When I enter 0000-00-00 in Value & Placeholder forr testing or set the read_data field by Custom Code to 0000-00-00 the date 2001-01-01 is written to the database.
Summary:
- I can not write empty field (NULL) to the database in a date or datetime field even when the tables default vaules are set to NULL.
- I can not write 0000-00-00 to the database, it's interpreted as 2001-01-01.
- I can not read 0000-00-00 without getting 2001-01-01 in the calendar field (avoided by changing 0000-00-00 to NULL in Custom Code after read action).
Everything has worked in the above mentioned old configuration.
Greetings
Nicolas
i have a problem adding and editing database entries with date / datetime fields.
Configuration:
Joomla 4.3.2
PHP 8.1.19
ChronoForms7 7.0.10
MySQL 5.7.41
I have to say, that the problem was not present with my old configuration (Joomla 3.10.11, PHP7.4, ChronoForms 7.0.10), every form worked until the upgrade to J4 and PHP8.
What happens:
- I insert entries into my DB vie a form and use the same form for editing. Testing with a simple form only containing some fields for create date and modified date for example plus 1 text field and one calender field.
- Trieed date or datetime as data format in the database.
- Default value for the date field is NULL or 0000-00-00
- When I add a database entry in PHPMyAdmin the default value is written (0000-00-00 or the field is NULL).
- When I add or modify an entry with Chronforms with a random date (e.g. 2023-06-07), everything works.
First Problem:
- Opening an existing entry with Chronoforms with the value 0000-00-00 shows 2001-01-01 and I have to klick a lot until the correct date.
Second Problem:
- Deleting an existing date value (empty field) or adding a record withou a selected date brings the error:
"22007 - 22007, 1292, Incorrect date value: '' for column 'test_date' at row 1"
(a similar problem was described with empty id, I had the same with the id and have to set it manually to 0 on insert although the database is set correct)
- When I try to write NULL, the same error occurs.
- When I enter 0000-00-00 in Value & Placeholder forr testing or set the read_data field by Custom Code to 0000-00-00 the date 2001-01-01 is written to the database.
Summary:
- I can not write empty field (NULL) to the database in a date or datetime field even when the tables default vaules are set to NULL.
- I can not write 0000-00-00 to the database, it's interpreted as 2001-01-01.
- I can not read 0000-00-00 without getting 2001-01-01 in the calendar field (avoided by changing 0000-00-00 to NULL in Custom Code after read action).
Everything has worked in the above mentioned old configuration.
Greetings
Nicolas