Mail contains different date than form

How to fix ChronoForms 8 email showing wrong date for selected event.

Overview

The problem is that the option value path in the form was not set to a unique identifier, causing the email to always display the last event with the same name instead of the selected one.
Set the option value path to contain only the unique event ID, not the formatted date or event name, to ensure the correct record is selected and sent in the email.

Answered
ChronoForms v8
ty typomaniac 12 Aug, 2026

Hi,

In a former CF 7 form, I used the following PHP to get data from JEvents. In the front end, the user could check all dates and they were correctly sent by mail.

After having migrated to CF 8, I have a strange problem: In the front end, the dates are displayed correctly. But in the mail, it displays always the last of same named events instead of the one that is chosen.

How comes?

The option text path is: <table><tr><td style="width:85px"><strong>{row:dtstart_formatted}:</strong> </td><td>{row:summary}</td></tr></table>

Strange enough: When I do not format the UNIX date, then frontend as well as mail show the exact same UNIX value. But... of course, I cannot display that...

The PHP is as follows, and the mail just contains {email:data_table}

$current_day = JFactory::getDate('+0 seconds');

$current_day = $current_day->toUnix();

$db =& JFactory::getDBO();

$query = "SELECT

#__jevents_vevdetail.dtstart,

#__jevents_vevdetail.summary,

#__jevents_vevdetail.extra_info

FROM #__jevents_vevdetail

INNER JOIN #__jevents_vevent ON #__jevents_vevdetail.evdet_id = #__jevents_vevent.detail_id

WHERE    #__jevents_vevdetail.dtstart > " . $current_day ." AND

#__jevents_vevent.access = 1 AND

#__jevents_vevent.state >= 1order by #__jevents_vevdetail.dtstart;

";

$db->setQuery($query);

$rows = $db->loadAssocList();

foreach ($rows as &$r) {

$r['dtstart_formatted'] = date('d.m.Y', $r['dtstart']);

}

return $rows;

Please note: I am not a programmer. The above code was constructed with the help of this forum, years ago.

Thanks so much for your help!

Martin

Max_admin Max_admin 29d ago

Hi Martin

When you use "dtstart" instead of "dtstart_formatted", are you getting the same list of items with the same date values or are they still wrong ?

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.

Dear Max,

first of all: thank you for taking care of this issue!

When you use "dtstart" instead of "dtstart_formatted", are you getting the same list of items with the same date values or are they still wrong ?

This only serves to convert UNIX timestamps into readable dates. When I use the regular dtstart, then we get this:

Please note three points:

  • The very form in CF 7 used to work flawlessly for years 😃
  • In CF 8, when not using the conversion, then we get the same UNIX value in the frontend - AND in the mail!
  • When using the conversion, we get the right order and date in the frontend, but ... it always sends the last of same named events.

So what I recommended my customer (who does not really feel happy about this) to make every event name unique (as you see on the screenshot). Then it works! Originally, these firefighters have lots of trainings, but lots of them have the same name. Just a different date of course.

To show what happens, I created three same named events (Testevent) with different dates. They are displayed correctly in the front end:

Mail contains different date than form image 1

When I choose the first one, I get this in the mail:

Mail contains different date than form image 2

When I choose the second one, I get this:

Mail contains different date than form image 3

Both show the date of the last of these three same named events.

What the heck could this be? I tested and fumbled for more than four hours. Just to find this workaround. 

If you need access to the backend, please let me know.

Best regards

Martin

Max_admin Max_admin 28d ago

Hi Martin

Ok, I was only trying to understand what is the problem exactly.

if the problem is that you get a specific record for records with the same name, then most probably the checkbox value you pass when selecting the record is not correct, it can be the record's name (which is not unique) or maybe the date, please make sure your checkbox value is the record's ID and that the ID should be unique, but the SQL statement does not return the record ID, you need to adjust that here:

SELECT

#__jevents_vevdetail.dtstart,

#__jevents_vevdetail.summary,

#__jevents_vevdetail.extra_info

FROM #__jevents_vevdetail

Then you can select the correct record to display using the ID, I do not know how you do that, you did not mentioned it.

Here is also a tutorial on the subject:

https://www.chronoengine.com/faqs/chronoforms/chronoforms8/how-to-write-a-full-custom-sql-query-in-chronoforms

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ty typomaniac 28d ago
Answer
1 Likes

Dear Max,

seems like I found it out, with a little help of Claude (but just to give me new ideas, not a working guide ...):

Mail contains different date than form image 4

The Option Value Path should only contain the event ID, nothing more, nothing less.

So: after hours of fumbling, testing, skipping meals, the issue is solved.

Thank you so much for caring about this issue!

Best regards

Martin

Max_admin Max_admin 25d ago

Hi Martin

No problem, you are welcome.

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Post a Reply