The chronoforms date validator wants dates to be in this format: 08/08/2008, but the DATE Data Type in MySQL wants 2008-08-08.
Likewise, the datetime picker built into the form generator in v3.0 uses the 08/08/2008 format as well. Is there any way to either get it to validate a date in the 2008-08-08 format or have it store 08/08/2008 as 2008-08-08 in the database?
I want to have users enter a date into a field (deadline). Then, using ChronoConnectivity - I want to to sort the records according to that date. To do that I need to ensure that the correct format is used for the DATE data type.
Anyone have any ideas?
Thanks!
maybe you can change the posted date format at the onsubmit after email box using the PHP strtotime function, something similar to this :
JRequest::setVar('date_field_name') = date('format', strtotime(JRequest::getVar('date_field_name')));
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Thanks!
Sorry, I'm not exactly what you would call a programmer - is the 'format' part supposed to be taken literally? I tried:
<?php JRequest::setVar('deadline') = date('format', strtotime(JRequest::getVar('deadline'))); ?>
and got:
Parse error: syntax error, unexpected '=' in ../components/com_chronocontact/chronocontact.php(533) : eval()'d code on line 1
No, it should be the MYSQL format: 'Y-m-d H:i:s'
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi redrings,
try this one :
date('Y-m-d H:i:s')
if you made an insert statement with this data for a DATETIME field then it will get inserted.
I'm sure this works because its used in other working components!
Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi,
I am new to Chrono Form.
I have a similar problem with date type in MySQL. There is only one field in my form now, date_0.
The Date Format is Y-m-d, Date Fields name is date_0
In On Submit code - before sending email, add
<?php
JRequest::setVar('date_0') = date('Y-m-d', strtotime(JRequest::getVar('date_0')));
?>
When select any date from the DateTimePicker, it looks good.
But the jos_chronoforms_test_date never been inserted.
Following is the debug info.
1. Form passed first SPAM check OK
2. Form passed the submissions limit (if enabled) OK
3. Form passed the Image verification (if enabled) OK
4. Form passed the server side validation (if enabled) OK
5. $_POST Array: Array ( [date_0] => 2009-06-20 [button_1] => Submit [bb90d6fc03c71e4d12f0285f5edf02a8] => 1 [1cf1] => 2041b199d3690eb7e6436f9079af9d98 [chronoformname] => test_date )
6. $_FILES Array: Array ( )
7. Form passed the plugins step (if enabled) OK
8. Debug End
Please help.
Thanks,
Philip
Hi pjywang,
I think that a MySQL datetime field needs either 'Y-m-d h:m:s' or a Unix timestamp - but please check
Bob
Hi Bob,
Thanks for your quick response. I am using ChronoForms_V3.1_RC5.1 and MySQL 5.0.
The datatype for the date field (date_0) is date, not datetime.
Following is the sql I dump from phpMyAdmin
CREATE TABLE IF NOT EXISTS `jos_chronoforms_test_date` (
`cf_id` int(11) NOT NULL auto_increment,
`uid` varchar(255) NOT NULL,
`recordtime` text NOT NULL,
`ipaddress` text NOT NULL,
`cf_user_id` text NOT NULL,
`date_0` date NOT NULL,
PRIMARY KEY (`cf_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
If you a backup of the form will help I can upload it.
Thanks,
Philip
Hi Philip,
If you can please turn on Global Debug in the Site Global Configuration and then submit the form , at the foor of the page you should see a long list of MySQL queries, see if you can pull out those that are being used here and see what is actually in the SQL. (Turn debug off afterwards if the site is live.)
Bob
•Profile Information•
Application afterLoad: 0.007 seconds, 0.34 MB
Application afterInitialise: 0.282 seconds, 4.49 MB
Application afterRoute: 0.321 seconds, 5.27 MB
Application afterDispatch: 0.557 seconds, 8.06 MB
Application afterRender: 1.090 seconds, 9.92 MB
•Memory Usage•
10453384
•18 queries logged•
1.
SELECT m.*, c.`option` AS component
FROM jos_menu AS m
LEFT JOIN jos_components AS c
ON m.componentid = c.id
WHERE m.published = 1
ORDER BY m.sublevel, m.parent, m.ordering
2.
SELECT *
FROM `jos_chrono_contact`
WHERE `name` = 'test_date'
3.
SELECT *
FROM `jos_chrono_contact`
WHERE `name` = 'test_date'
4.
SELECT *
FROM `jos_chrono_contact_emails`
WHERE `formid` = '4'
ORDER BY emailid
5.
SELECT *
FROM `jos_chrono_contact`
WHERE `id` = '4'
6.
SELECT *
FROM `jos_chrono_contact`
WHERE `id` = '4'
7.
SELECT *
FROM `jos_chrono_contact_plugins`
WHERE `form_id` = '4'
AND event IN ('ONSUBMIT','ONLOADONSUBMIT')
AND `name` = ''
8.
SELECT *
FROM `jos_chrono_contact`
WHERE `id` = '4'
9.
SELECT *
FROM `jos_chrono_contact_plugins`
WHERE `form_id` = '4'
AND event IN ('ONSUBMIT','ONLOADONSUBMIT')
AND `name` = ''
10.
SELECT *
FROM `jos_chrono_contact`
WHERE `id` = '4'
11.
SELECT *
FROM `jos_chrono_contact`
WHERE `id` = '4'
12.
SELECT template
FROM jos_templates_menu
WHERE client_id = 0
AND (menuid = 0 OR menuid = 0)
ORDER BY menuid DESC
LIMIT 0, 1
13.
SELECT id, title, module, position, content, showtitle, control, params
FROM jos_modules AS m
LEFT JOIN jos_modules_menu AS mm
ON mm.moduleid = m.id
WHERE m.published = 1
AND m.access <= 0
AND m.client_id = 0
AND ( mm.menuid = 0 OR mm.menuid = 0 )
ORDER BY position, ordering
14.
SELECT *, RAND() AS ordering
FROM jos_banner
WHERE showBanner = 1
AND (imptotal = 0 OR impmade < imptotal)
AND cid = 1
AND catid = 33
ORDER BY sticky DESC, ordering
LIMIT 0, 1
15.
UPDATE jos_banner
SET impmade = impmade + 1
WHERE bid = 7
16.
SELECT a.*, CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END AS slug, CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END AS catslug
FROM jos_content AS a
INNER JOIN jos_categories AS cc
ON cc.id = a.catid
INNER JOIN jos_sections AS s
ON s.id = a.sectionid
WHERE a.state = 1
AND a.access <= 0
AND cc.access <= 0
AND s.access <= 0
AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2009-06-19 21:14:12' )
AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2009-06-19 21:14:12' )
AND cc.id = 3
AND cc.section = s.id
AND cc.published = 1
AND s.published = 1
ORDER BY a.ordering
17.
SELECT joomlatablename,tablepkID
FROM `jos_jf_tableinfo`
18.
SELECT jf_content.reference_field, jf_content.value, jf_content.reference_id, jf_content.original_value
FROM jos_jf_content AS jf_content
WHERE jf_content.language_id=1
AND jf_content.published=1
AND jf_content.reference_id IN(42,41,2,3,4)
AND jf_content.reference_table='content'
•Language Files Loaded•
* C:\source_web\htdocs\joomla\language\en-GB\en-GB.ini 1
* C:\source_web\htdocs\joomla\language\en-GB\en-GB.plg_system_debug.ini 1
* C:\source_web\htdocs\joomla\language\en-GB\en-GB.com_chronocontact.ini
* C:\source_web\htdocs\joomla\language\en-GB\en-GB.tpl_rhuk_milkyway.ini 1
* C:\source_web\htdocs\joomla\language\en-GB\en-GB.mod_syndicate.ini 1
* C:\source_web\htdocs\joomla\language\en-GB\en-GB.mod_banners.ini 1
* C:\source_web\htdocs\joomla\language\en-GB\en-GB.mod_footer.ini 1
* C:\source_web\htdocs\joomla\language\en-GB\en-GB.mod_mainmenu.ini 1
* C:\source_web\htdocs\joomla\language\en-GB\en-GB.mod_breadcrumbs.ini 1
* C:\source_web\htdocs\joomla\language\en-GB\en-GB.mod_jflanguageselection.ini 1
* C:\source_web\htdocs\joomla\administrator\language\en-GB\en-GB.plg_joomfish_missing_translation.ini 1
* C:\source_web\htdocs\joomla\language\en-GB\en-GB.mod_search.ini 1
* C:\source_web\htdocs\joomla\language\en-GB\en-GB.mod_newsflash.ini 1
•Untranslated Strings Diagnostic•
•None•
•Untranslated Strings Designer•
•None•
Hi Philip,
It looks as though it isn't being executed at all ?-(
Bob
Hi Bob,
I forgot to turn Data Storage on using the following
click the form name > DB Connection > Enable Data Storage = Yes.
Thanks so much for your fast respond. Great support.
Philip
Hi Philip,
That would explain it - glad it's fixed.
Bob