TOPIC:

Form date value different from submitted date 1 year 6 months ago #232666

  • Topic Author
  • Mobilepro
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 94
  • Thanks: 0
I use a hidden date field in my forms that loads today's date as the value using
<?php return date("m/d/Y") ?>
. This has always worked but now I'm noticing that it is off by a day ( it shows the next day's date) compared to the submitted date in the database (which has the correct time and date).

Any idea what would cause this?

Thanks

Please Log in or Create an account to join the conversation.

Form date value different from submitted date 1 year 6 months ago #232673

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello,

It might be that the server time isn't set properly since this function should return today's date. I assume that is causing the issue.

ALso, you can go through this piece of documentation about the date function and you might find something useful php.net/manual/en/function.date.php .


Regards,

Mihaela

Please Log in or Create an account to join the conversation.

Form date value different from submitted date 1 year 1 month ago #236573

  • geeksscript
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 86
  • Thanks: 1
Hi Mihaela!

I have a hidden field with below value to store date:
<?php return date('Y-m-d h:i:s');?>

In a recent case, one of the user visited the form page & submitted it after 17 hours approx, which caused inaccurate submission date to be stored in database table (via integrator).

Please check below image:


How can I store the submission date & not the one of page load?

Please guide.

Thanks
Attachments:

Please Log in or Create an account to join the conversation.

Form date value different from submitted date 1 year 1 month ago #236590

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello,

OK, I understand, since what is put as field's value is filled in on form load, it will return the page's load time instead of the submit time.

Here is you can make it work so that the submit time is saved.

Please go to the Advanced properties of that field for filling in the date.
Then in the Initscript section set Type to Custom and check the "Form Entry" checkbox.

In the code area below put the following code:
function ff_scriptdate_init(element, condition)
{
 setInterval(caltime, 500);


} // ff_scriptdate_init


function caltime() {
var date = new Date();

var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();

ff_getElementByName("scriptdate").value = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
}
NOTE: In order for this to work on your form please replace bothe instances of scriptdate with the Name of that fate field.

Let me know whether this solution works for you.

Regards,

Mihaela
The following user(s) said Thank You: geeksscript

Please Log in or Create an account to join the conversation.

Form date value different from submitted date 1 year 1 month ago #236592

  • geeksscript
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 86
  • Thanks: 1
Hello Mihaela,

Thank you for the solution. Please check below image:


There is a difference of 25 seconds between both the values. Just wanted to check if there is a way to directly save the submitted date into the date column? Because via browser inspect, I noticed the date value is constantly being updated every second. I hope this does not increase memory usage on server.

Please let me know.
Attachments:

Please Log in or Create an account to join the conversation.

Form date value different from submitted date 1 year 1 month ago #236596

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello,

Setting this to work exactly as you wanted requires a custom solution and unfortunately, that is out of the scope of our support.

I hope that you will manage to use the solution provided.

Regards,

Mihaela
The following user(s) said Thank You: geeksscript

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.120 seconds

Summer Sale!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!