Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Email Submit Button - Change Text/Confirm submission

Avatar

Level 1

I have an Email Submit Button on my survey, which I am 'distributing'.  I would like for it to do 2 things once you click on the "Email Submit Button":

1) Text of the button changes once it been clicked on in order to show that the survey was submitted. Right now, all I can figure is how to have the text change when you roll over the box or for the secnod you click on the box-- i want the caption to change once its been clicked.

2) a text box appears below that can act as a "thank you for submitting your survey...".

any help and advice is much appreciated!

5 Replies

Avatar

Former Community Member

An email submit button is not programmable .....so you will have to create a second "regular"

button and put this code on that one. You can hide the email sumit button as we will click it on the regular button.

emailSubmitButtonName.execEvent("click");

this.caption.value.text.value = "Clicked";

app.alert("Thank you for submitting your survey!")

Note that this is Javascript code. Also there is no way to tell that the email was actually set, so you are putting up an artificial message saying  that the survey has been recieved.

Paul

Avatar

Level 1

Thanks for the response Paul.  I feel like i'm very close, but I'm still not there... I'm not sure where to enter this javascript you sent me.  The only script I know to find is the XML Source ...if that's the right place, where do I enter your code?

<field name="Button1" y="241.3mm" x="66.675mm" w="73.025mm" h="9.525mm">

<

ui>

<

button/>

</

ui>

<

font typeface="Myriad Pro"/>

<

caption>

<

value>

<

exData contentType="text/html">

<

body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="2.5.6290.0"><p>simply<span style="xfa-spacerun:yes"> </span><span style="color:#ff0000;font-weight:bold">CLICK HERE</span> to submit via e-mail</p></body>

</

exData>

</

value>

<

para vAlign="middle" hAlign="center" spaceAbove="0pt" spaceBelow="0pt" textIndent="0pt" marginLeft="0pt" marginRight="0pt"/>

<

font typeface="Myriad Pro" baselineShift="0pt"/>

</

caption>

<

border hand="right">

<?templateDesigner StyleID apbx2?>

<

edge stroke="raised"/>

<

fill>

<

color value="212,208,200"/>

</

fill>

</

border>

<

bind match="none"/>

</

field>

</

subform>

Avatar

Former Community Member

Do not touch the XML source unless you really know what you are doing. There is a script editor provided in th eproduct for y

ou to enter your script. It is probably hidden. - under the Window menu make sure that the Script Editor has a check mark beside it. By default it appears above the drawing area and it can be resized to fit your need.

screen1.jpg

On the image above, the Blue highlight is the script editor itself, the Pink box is the handle that lets you resize the window, the Green box indicates where to set the language that you want and the Red box is the dropdown that lets you choose the event you want to program against. In this case the button is highlighted so it is the button's click event that we are scriptingn against.

Make sense?

Paul

Avatar

Level 1

I think this all makes sense -- BUT I must be doing it wrong because its not working.

The new, regular button is not changing text after I click on it.

Here is a snapshot of what I did:

Show: click*

Language: JavaScript

Run At: Client

----- form1.#subform[0].Button1::click: - (JavaScript, client) -------------------------------------

emailSubmitButtonName.execEvent("click");

this.caption.value.text.value

= "Clicked";

app.alert("Thank you for submitting your survey!")

And then I pushed on the Green plus sign button....

ScreenHunter_04 Mar. 17 16.25.gif

Avatar

Former Community Member

The script is not running beacuse the 1st line of code is calling an object that does not exist. I did not know what your button name would be so I tried to put a generic name that you would realize you had to replace. You must replace the name emailSubmitButtonName with the actual name of your button. Just to validate this theory, try commenting out the 1st line (add a // to the beginning of the line) and try it again. Your caption should change and your message should popup (the email will not be sent though).

Paul