Contactform : unique number for every submission
Is it possible to add a unique number to a submission from someone into a contact form?
It's easier for us to follow up later on then .. i've tried to look it up / sort it out but can't manage to find a way.
Anyone? :)
Hmm. Haven't done this, but I think you can do it like this: when you send a message with a form made with the formbuilder, it will be saved to the database and then it sends a mail. I suppose you can dive into the php file (frontend/modules/form_builder/widgets/form.php
) to the validateForm
method and try to get the id
or data_id
from the forms_data
or forms_data_fields
tables with a query. The id is a unique ID that gets incremented with every submission.
If you manage to retrieve this id in your php code, you can add it to the fields
array (or something else). Be sure to define the field label (such as "Submission ID") and value (the actual id). In the template file located at /frontend/modules/form_builder/layout/templates/mails/form.tpl
you will see that the field label and value are printed inside a loop.
Normally you should see the unique id in your e-mails from now on. I would make the unique ID the first field in your email (so the first item in the fields array) :-)