[Solved] Date field to record the date and time when the send button is pressed

giusebos

Member
Hi,
I've a form where is possible digit some data, then when the operators press the button save the form is send by email.

I need only registered automaticaly the date and time of saving/send.

Subsequently who open and send the form can change some data but I need that the date can't update.
The date of saving/send must be saved in the database only one time, the first time.
Thanks in advance for your suggestions
 
Hi, I've partial solved my problem whith timestamp plug-in, but I'm traing setup it on GTM and local server but in any case it show two more hours of my server.
Any suggest about?
Thanks in advance
 
ok, actually I solved just that, but I couldn't get what I wanted:
I have a very long form, it takes at least 4 minutes to compile it;

I would like to capture the time when the form is sent and saved in the database (it is also sent by email)
 
If you're using a PHP form plugin now, what's its setting for "On"? Make sure it's set to "New", then it'll run only for new records, not on edit.
 
See your second screenshot (02.jpg = the one of the PHP form plugin): you have set "On" to "Both". As I said, set it to "New" instead for it to run for new records only, and not when they're being edited.
 
Also, in the "date" element plugin, set "Always return today's date" to "No".
(At "Yes", it would obviously always overwrite the date and time with the current one, also on edit. With that set to "No", you'll probably not even need the form plugin.)
 
Thanks for your help.
I did as you indicated, unfortunately I always get the opening time form. I did a test waiting 5 minutes before saving: unfortunately the date and time are those of opening forms.
 
replaced onAfterProcess with onBeforeProcess leaving unchanged:
PHP:
$formModel->updateFormData('aa_tickets___data_inoltro_tickets', 'string value', true);

No time is recorded
 
Uhmmm... one must trust that you're not really using 'string value' in your code...
Or must it be explicitly said that this wants to to be the actual date/time?
 
I did tests with and without the string, no useful results
Now seriously... it's not about "with" or "without", it's about the correct string and, for what you want, that's got to be a date and time in the correct format, such as '2019-07-22 09:44:12'.
Needless to say (?), if you want it to be the current date, you can get it per PHP and insert it there.
 
it's not a question of format !! the time (and date) when it is recorded is the form opening date.

I need to record the time when I save the form!
 
If you do it with the PHP form plugin onBeforeProcess, would you agree that...
1. 'string value' is not the current date and time?
2. instead you need to have date and time in the correct database format? (This would be something like '2019-07-22 09:44:12', obviously.)
3. to get the current date and time, you'll need to get it first and, since we're talking a PHP plugin, that getting and having it formatted correctly in PHP is the way to go?

https://www.w3schools.com/php/php_date.asp
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top