Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Script error?

Avatar

Former Community Member

Hello people,

I'm new to form design and scripts (and this forum) and have run into a brick wall that I have been unable to resolve and hope, it's a simple error that only a begginer would make, and one of you can easily resolve it.

The form needs to be submitted, as a PDF form, to different people depending on who is filling out the form.

I have put in a 'choice list' and tried to write a event script but when the 'submit email' button is pressed it only seems to do the previous 'event' which sends a pdf to one person, it is not picking up a person from the 'choice list' and is not performing other actions in the script either such as the subject line and some body text. I suspect, but could be wrong, that perhaps it is the 'this.resolveNode' as I do not know what 'this' refers to, have tried a few things but none of them worked, the last thing I tried was 'choiceList' which is still inserted.

Looks like I cannot attach the document so I will copy & paste the code which I think is wrong, if anyone would like me to email them the actual document you can email me on ihopkins@oakdaletas.org

<

field h="6mm" name="EmailSubmitButton1" w="34.925mm" x="168.275mm" y="85.725mm">

<field h="34.925mm" name="ListBox1" w="36.6mm" x="165.1mm" y="47.625mm">

<

ui>

<

choiceList commitOn="exit" open="multiSelect">

<

border>

<?templateDesigner StyleID aped3?>

<

edge stroke="lowered"/>

</

border>

<

margin/>

</

choiceList>

</

ui>

<

items>

<

text>ABI</text>

<

text>Burwood</text>

<

text>CLP</text>

<

text>Lodge\ILU</text>

<

text>Firthside</text>

<

text>Nolan</text>

</

items>

<

items presence="hidden" save="1">

<

text>lwhitney@oakdaletas.org</text>

<?templateDesigner isEmailSubmitObject true?>

<

ui>

<

button/>

</

ui>

<

font typeface="Myriad Pro"/>

<

caption>

<

value>

<

text>Submit by Email</text>

</

value>

<

para hAlign="center" vAlign="middle"/>

<

font typeface="Myriad Pro"/>

</

caption>

<

border hand="right">

<?templateDesigner StyleID apbx2?>

<

edge stroke="raised"/>

<

fill>

<

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

</

fill>

</

border>

<

bind match="none"/>

<

event activity="click">

<

submit format="pdf" target="mailto:rarcher@oakdaletas.org" textEncoding="UTF-8"/>

</

event>

<

event activity="mouseDown">

<

script contentType="application/x-javascript">

oSubmit = choiceList.resolveNode("$..#submit");

cToAddr = "RArcher@oakdaletas.org"

cCCAddr = CompanyEmails.rawValue (/\-\n?/,";") .replace(/\n/g,";");

cSubLine = "Request for Leave submitted by:"

+ Name.rawvalue + " ";

cBody = Dear " + Name.rawValue + " " + "Thank you for submitting your request for leave, we will let you know if the selected dates are available as soon as possible.";

cEmailURL = "mailto:" + cToAddr + "?";

if(cCCAddr.length)

cEmailURL += "cc=" + cToAddr + "&amp;";

cEmailURL += "subject=" + encodeURI(cSubLine) + "&amp;body=" + encodeURI(cBody);

oSubmit.target = cEmailURL";});</

script>

</

event>

The code for the choice list is as follows (in case that is the error source)

<

text>aozols@oakdaletas.org</text>

<

text>tpercival@oakdaletas.org</text>

<

text>tchandler@oakdaletas.org</text>

<

text>afarrell@oakdaletas.org</text>

</

items>

<

font typeface="Myriad Pro"/>

<

margin bottomInset="1mm" leftInset="1mm" rightInset="1mm" topInset="1mm"/>

<

caption placement="top" reserve="5mm">

<

font typeface="Myriad Pro"/>

<

para vAlign="middle"/>

<

value>

<

text>Company emails</text>

Thank You

text>sfisher@oakdaletas.org</text>

<

text>sfisher@oakdaletas.org</text>

<

text>tpercival@oakdaletas.org</text>

<

text>tchandler@oakdaletas.org</text>

<

text>afarrell@oakdaletas.org</text>

</

items>

<

font typeface="Myriad Pro"/>

<

margin bottomInset="1mm" leftInset="1mm" rightInset="1mm" topInset="1mm"/>

<

caption placement="top" reserve="5mm">

<

font typeface="Myriad Pro"/>

<

para vAlign="middle"/>

<

value>

<

text>Company emails</text>

Thank You

1 Accepted Solution

Avatar

Correct answer by
Level 10

Here is a sample which may help you..

https://acrobat.com/#d=CK4QgXn38l49bzQlhWtKSA

Check the button properties I put in.. And in the sample, I am taking the values from TextFields on the form. You can change the code to take it from a dropdown field on your form.

Thanks

Srini

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

Here is a sample which may help you..

https://acrobat.com/#d=CK4QgXn38l49bzQlhWtKSA

Check the button properties I put in.. And in the sample, I am taking the values from TextFields on the form. You can change the code to take it from a dropdown field on your form.

Thanks

Srini

Avatar

Former Community Member

Hi Srini

I'm showing my 'begginer status' here I copied and pasted your code in and tried to change to match my form now when I press the submit button I get a message "Submit Cancelled', now get no email at all.

Sorry I'm at a very early stage of learning.

<event activity="click" name="event__click">

<

submit format="pdf" textEncoding="UTF-16" xdpContent="pdf datasets xfdf"/>

</

event>

<

event activity="preSubmit" ref="$form" name="event__preSubmit">

<

script contentType="application/x-javascript">

var strToAddress, strCCAddress, strSubject, strMessage

strToAddress = rarcher@oakdaletas.org;

strCCAddress = ListBox1.rawValue;

strSubject = Annual Leave Application;

strMessage = Thank You for your application, it will be dealt with as soon as possible;

event.target.submitForm({cURL:"mailto:"+ strToAddress + "?cc=" + strCCAddress + "&amp;subject=" + strSubject + "&amp;body=" + strMessage,cSubmitAs:"PDF",cCharset:"utf-8"});

//this.resolveNode("#event").submit.target = "mailto:"+ strToAddress + "?cc=" + strCCAddress + "&amp;subject=" + strSubject + "&amp;body=" + strMessage;</

script>

</

event>

Avatar

Former Community Member

Hi again

Getting there, as soon as I posted the last message it stuck me I needed to add " " on some lines which I did, it now seems to work ok, however after the email has been sent a dialouge box with the message "submit cancelled' still pops up even though the email has been sent?

Cheers and thanks for your help

Regards

Ian

Avatar

Former Community Member

Further Issue

As almost all users have access to only Adobe Reader so I have used the 'Enable User Rights in Adobe Reader' option, so that users can insert their signature and email the form, however when the user puts in their digital signature it asks them to save the file somewhere before inserting the signature, is there a way around this so that the user isn't prompted to save the file somewhere?

Thanks again.

Ian