Forums

Write data to database instantly after first field is completed

shamesaaron 29 Oct, 2019
Hello,

I am creating a simple lead generation form with a few fields which will be saved to database and also emailed once submitted. This is working fine, the form is an AJAX form.

The first field in the form is the email address which is required, I want to make an event after this field is completed (onChange) that will save the data to the database immediately. This way if the user completes the rest of the form, we will update the database with remaining data, but if not, at least we already captured that users email address. This is something that I could figure out how to do with all raw code and javascript, but it is a little bit difficult to figure out how to do this within Chronoforms. All of the options I think are needed are available, I just can't figure out:

What to set in the Events tab of the email text field except for trigger being Change

How to setup the Actions main tab properly to allow my Change event trigger to write this field to the database. Should I setup an action within Submit that we can call early? Or do I setup an action in onLoad?

Any help or guidance towards another post accomplishing something similar would be greatly appreciated.
GreyHead 29 Oct, 2019
1 Likes
Hi shamesaaron,

First I suggest that you don't do this; it's not good practice.

If you still decide to do it then add a new form event, return the email to that event, validate and save the data, then return the record I'd so you can add that to a hidden input in your form and use it to update the record on submit.

Bob
shamesaaron 29 Oct, 2019
Hi Bob,

I learned this tactic from a site I was going to submit an order on. They asked for email address first in the order process.. and after completing this field I changed my mind about the order but they still followed up with me and put me into their marketing system. I thought it was genius. It was a little different from a lead generation form as I had already selected something in my cart to buy, and then abandoned the form after only inputting the first field.

What about this tactic is not good practice?

Also can you be a little bit more specific about how to get this done, I am fairly familiar with chronoforms just need some minor help. Where do I add a new form event? I only see the ability to do that onLoad or onSubmit. Do I choose one of those or is there another place to put an event?

Thanks,

Aaron
GreyHead 30 Oct, 2019
1 Likes
Hi Aaron,


In the EU where I am there is a law that says you need consent to collect user data. Google GPDR for more info.

I'm not at my desk right now but you should be able to drag and drop a new event after the Load and Submit events.

Bob
healyhatman 30 Oct, 2019
You might think it's genius, but if I started getting spam emails from a website I decided against signing up for I'd be PISSED.
This topic is locked and no more replies can be posted.