I am trying to set up a field in a database table that shows the date and time a user submitted a message. I set up a chronoform that allows users to contact my company and the data from the form posts to a mysql database.
I added a hidden field with a name that matches the the database field name. I then added "date("Y-m-d H:i:s")" in the value field. The code generated is
<input value="date("Y-m-d H:i:s")" id="hidden_7" name="message_sentdate" type="hidden" />. I also tried "<?php echo date("Y-m-d H:i:s") ?>". The former does nothing and the latter returns a parse error when I try to generate the form on the actual website.
I've tried a few variations of the above entries and nothing is working. Thanks for the help.
Brian
Hi Brian,
as Bob said, there is a field to hold the date time automatically, however if you are trying your own one then you may try this code:
<?php echo date("Y-m-d")." - ".date("H:i:s"); ?>
Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
So there should be a field in the toolbox labeled "recordtime" which can be inserted into the form as a hidden field? If so, I don't see it. Or do I just add "recordtime" to the Form Fields names in the Auto Generated Code tab? Thanks,
Brian
Hi Brian,
It's added automatically if the field exists in the database table. If you created the table with ChronoForms then it will already be there unless you unchecked the box.
Bob
Nice, just add a database field named "recordtime" and it works perfectly! That is about as simple as it gets...
Thanks for the help.
Hi All,
I used {recordtime} in my email template and i receive the same code {recordtime} in my email instead of the exact time stamp. My form does use the {recordtime} field and it does collect the correct date and time so i know its working. Am i doing something wrong?
~Alex
Hi Alex,
use this in the email template:
<?php echo date("Y-m-d")." - ".date("H:i:s"); ?>
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
I've placed the code in the email template and still i get get a blank when receiving the email. Any other thoughts? :wink:
Hi boogieman,
[sendfb][/sendfb]
Bob
Hi there,
Attached is a backup of my form. Thanks for your assistance
~Alex
Hi Bob,
Thanks for your help. I now have everything working except the timestamp. The reason you didn't see the {recordtime} was because i replaced it with this..<?php echo date("Y-m-d")." - ".date("H:i:s"); ?> and that didn't work. I have inserted {recordtime} again in my form and I still see nothing appear in my email! 🙂
~Alex
Hi Alex,
I'm sure that if you disable the email template editor and add this code, it will show a date/time stamp wherever its in the template:
<?php echo date("Y-m-d")." - ".date("H:i:s"); ?>
show me your template code ? do you have the editor disabled ? it will mess it if its enabled!
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Where does the time come from?
My recordtime is about 7 hours off....😶
Any idea?
Thanks
Bart
Hi Bart,
It's usually the server time. Maybe there's a timezone adjustment needed.
Bob
When you say turn your editor off do you mean in Global Settings for the joomla! user that you are logged in as?
Kind Regards,
Si
Hi Si,
If it's the template editor then you can turn it off in the Email Setup Properties box.
Bob
I was logging in here thinking "I bet no-one has answered my question, no-one ever helps me!"
I logged off yesterday and spent quite a while switching off the editor both in joomla Global Settings and User profiles to absolutely no effect. Then I found the setting in Components-Chronoforms-Edit Form-Setup Email-Email Properties-Use Template Editor and was just coming on here to share this solution.
And who is there to destroy both my self pity and pride? Bob! That's who! Thanks a lot Bob.
I have, admittedly, casually and hurriedly evaluted several of the main forms solutions for joomla and believe there may be better solutions for specific specialist requirements however I have to hand it to the Chronoengine team. You have a holistic and quite comprehensive solution that allows folks to rapidly prototype working forms with a minimal level of upfront technical knowledge, learning, effort or funding. There is clear and concise documentation available and a fee free support forum providing a superior level of assistance. Sure it isn't perfect, but on the whole it works and it works really well.
I don't have a great amount of funds to spend and have held off paying the subscription here thinking that maybe there might just be a better use for the money I have available. I have to admit defeat, you win.
Pleased to see you have a book out too, Bob. I will be privately investing in an e-book copy.
I will be taking out a subscription this evening.
Si
Hi Si,
;-) :-)
Rumours are that the book is due out on Friday . . . but I'm still waiting on final versions of a few chapters so I'll believe it when I see it.
Bob
Hi GreyHead
Where can I change "Y-m-d" to "d-m-Y" in the code to stay permanent?
Thanks, Paul
Hi Paul,
I'm not sure I understand the question completely. You can change the settings for each from in the form General tab.
Bob
Sorry Bob, I should have elaborated more. I am talking about the "recordtime" field. The time in the database table is displayed in Y-m-d and it is set in the autogenerated code as far as I can see. I can't find any way to change it.
Hi Paul,
Hmm . . . it would be a deep hack to change that format (it's actually close to the MySQL date-time format and MySQL will happily read it that way). You can either add code to transform the dates on display - I usually do this; or you could add a separate column to store dates in a different format.
Bob