Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Having form sent to email address (possibly using bcc)

Avatar

Level 2

Is there a way to hardcode a particular email address that cannot be changed so when the submit button is pressed it sends a copy to it and the user cannot change the destination address?  We are looking for a way to track the form as it is submitted for loss prevention measures.  Is this possible?

Thanks in Advance

Ken

4 Replies

Avatar

Level 10

Hi Ken,

There are a couple of ways of setting up Submit by email. There is the dedicated button, the regular button can be set to be submit and then you can also just use a regular button with a script in the click event.

However in all cases, when the user clicks the button, it will open a new email message in the user's email client. Even if you have scripted a BCC, the user can still delete that email address in the message before sending it.

There are examples of email buttons here: http://assure.ly/eUR4wJ.

It would probably be more robust to submit using http and then process the response at the backend. But I think that may not be the way you want to go.

Good luck,

Niall

Avatar

Level 2

Niall -

I understand the email concept, thank you, I figured it wasn't something that could be done through script as everyones email service is different and how they handle bcc's can vary.

I have one last question regarding this project, and this is now just getting the form to be aesthetically pleasing and as automatic as possible.

How do you make a date and time field populate on its own, when the form opens without the ability to change it when it populates?

Avatar

Level 2

Niall,

That has certainly helped; I do have one more question for you. I was reading through the lock all fields thread and found the code that would do that on a button titled 'lock all fields'. I am wondering if there is a way to script that code into the submit by email key. I tried to use the click event but it won't let me put anything there. Is there a way to do this so it locks when the email button is clicked?

Avatar

Level 10

Sorry for delay.

You can add the call to Paul's LockAllFields function - you just need to make sure that this is called before the email script.

For example, it should work in the mouseUp event of the email button, as this event fires before the click event.

Note, you will need to include Paul's script object in your form.

Hope that helps,

Niall