Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Help creating a dynamic subject line from email submitted forms

Avatar

Level 1

Hey guys,

Would anyone be able to help me out, I want to be able to edit the email submit button so that when you click submit it will put in a customised subject line but this needs to change with a drop down list that I have in the form as well.

Is this possible if it is could you let me know ?

Tah

Ps. If I haven't made clear what I'm after just let me know

1 Accepted Solution

Avatar

Correct answer by
Level 10

Here is the form with exactly what I've said above.

Create a normal button instead of a submit button, and in the click event insert the code to submit a form

I've changed the values instead of accessing the text fields' raw value, I've inserted the values for the email, subject and body message within variables in the click event

Obviously, when you tried with the code above if you haven't changed the values for email, subject and body message it might be the reason why it was creating an error.

I hope this will help you, if you have any questions feel free to ask.

WAW.pdf - Google Drive

View solution in original post

10 Replies

Avatar

Level 10

Hi there,

There should be everything you need on this thread.

customizing email body on email submit button

Hope this will help you!

Avatar

Level 1

Hi,

Thanks for the reply, unfortunately what ever I try in that thread doesn't work I keep getting Error: Accessor 'RealEmail.event__click.submit.target' is unknown.

I'm fairly new at this any help ?

Avatar

Level 10

Hi there,

Instead of using a submit button, create it yourself with a normal button, use the following code to submit the form

Hope this will help

Avatar

Level 1

Hi Magus,

I tried doing that but it says error in syntax and highlights the event.target.submitForm({ line and specifically highlights { as the problem

Any thoughts ?

Avatar

Level 10

Not sure, it works fine here when I try it out.

Is your form dynamic? I don't know if it could work for interactive / static form...

If you can, you could share your form I'll take a look at it when I have the time.

Avatar

Level 1

Hi Magus,


Sorry as I've mentioned I'm quite new to this but willing to learn , How would I go about sharing it for you to take a look at. Which is very kind of you by the way.

Avatar

Level 10

Hi again,

you can use either Drive from gmail, oneDrive from hotmail, Dropbox or any sharing method that you are currently using.

Avatar

Level 1

Hi,

Thought there was some way to do it in the forums Anyway here is our form ShareFile . We want it to be able to dynamically change the subject line of the email depending on whatever is selected in the neighbourhood drop down field.

If it isn't too much trouble would you be able to leave instruction on how to do so ?

Avatar

Correct answer by
Level 10

Here is the form with exactly what I've said above.

Create a normal button instead of a submit button, and in the click event insert the code to submit a form

I've changed the values instead of accessing the text fields' raw value, I've inserted the values for the email, subject and body message within variables in the click event

Obviously, when you tried with the code above if you haven't changed the values for email, subject and body message it might be the reason why it was creating an error.

I hope this will help you, if you have any questions feel free to ask.

WAW.pdf - Google Drive

Avatar

Level 1

Hi Magus,

Thank you very much for this, works perfectly.

Jack