Remembering the date when form is submitted in custom field

Hi,



I’m trying to remember the date when the form i made in mautic is submitted in custom field.



Basically, when user submits the form the date of submission needs to be saved in some custom field. Also this has to happen automatically, user should not be forced to type in the date.



How can i do that with mautic?



Thanks!

I have exactly the same requirement (to store an opt-in date in the database).

My approach would be (not tested):

  1. Create a hidden field in the form and map it to a lead field
  2. Choose manual copy for the form HTML
  3. Add a <?php getdate() ?> in the form field value
  4. Paste the form HTML to your target page
  5. Make sure PHP code can be executed

Hi,

I’m trying to remember the date when the form i made in mautic is submitted in custom field.

Basically, when user submits the form the date of submission needs to be saved in some custom field. Also this has to happen automatically, user should not be forced to type in the date.

How can i do that with mautic?

Thanks!

I approached this by adding a custom field and then adding a trigger to the database

I wanted to know about new leads but it would be easy to adapt this for existing ones too.

CREATE TRIGGER add_date BEFORE INSERT ON mautic_leads
FOR EACH
ROW SET new.applicationdate = CURDATE( )

Dear Wbuist, this is exactly what I am looking for. I want to make use of the same form on different pages. On each of these pages I have a custom field called ‘Formtag’, e.g. on http://www.allianceexperts.com/en/ten/find-agent-distributor-exports-poland/.

Could you explain in a few more steps for this ‘beginner’ how you would get the contents of this custom field in Wordpress with the contact record? I have already created a Custom field in Mautic for it: ‘Source’.

The solution above works to get the data into the Mautic record rather than a Wordpress custom field. I’m not sure of the best approach to the issue you are seeking to solve.

@wbuist Thanks a lot for your post from Nov 15. Could you please send detailed steps about how and where you use this to automatically enter the current date in a custom Mautic field?

Thanks a lot!

@nickbuc Hi Nick, Firstly you need to add a field to the contact record in Mautic. I called it Application date.

Then I logged on to PHPMyadmin and navigate to the Mautic database and set up the trigger with this code:

CREATE TRIGGER add_date BEFORE INSERT ON mautic_leads
FOR EACH
ROW SET new.applicationdate = CURDATE( )

HTH

Hi wbuist, if you can do this with the date, is it also possible to do this with the url of the page where the form is? That would help me a lot. I refer to the same forms from various pages such as here, here and here, but would like to be able to distinguish where the contact comes from.

I followed your instructions and also went to PhpMyadmin, where I found the option of Add Trigger. The only point is that I get a syntax error. Could you please point out what I’m doing wrong. I’m using the standard field ‘Attribution date’ to get the date there, as in your example.

Hi,
@DutchAlfred
Just put SET new.applicationdate = CURDATE( ), delete FOR EACH ROW