Expand my Community achievements bar.

SOLVED

Drop down list selection chooses Email receipent upon "submit"

Avatar

Level 1

I have created a drop down list that binds e-mail addresses to the choice the end user makes in the field/list. Am looking for the simplest way to use this choice in conjunction with a form button that will submit the completed form, in PDF format, to the correct email receipent that was chosen. Would also like the email, with the filled out form attached, to open, allowing the end user to attach additional attachments before sending. Am new to LiveCycleES but do know about extending rights to the document for others to be able to access.Any help would be greatly appreciated.

Regards, Nugget

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

That address that is showing up is the one that is hard coded in the real email button. There is some additional code that needs to be added ...so replace the code that you have with this code:

if (EmailAddress.rawValue != null){
Button2.event__click.submit.target = "mailto:" + EmailAddress.rawValue + "?subject=" + Subject.rawValue;
Button2.execEvent("click");
} else {
app.alert("Please enter an email address in the Email field");
}

Then change the email fields name from TextField4[1] to EmailAddress. Now try it again. If you want I can attach the modified version to this thread ...but everyone will be able to see it and get it.

Paul

View solution in original post

14 Replies

Avatar

Former Community Member

Here is a sample of the different ways that you can control email.

Paul

Avatar

Level 1

Paul,

Thanks for the assistance!

I used the third option shown in the example and set the buttons, fields, and all properties on my form to mimick the ones on the example. The completed form fills out fine but when the "fake" email button is clicked, nothing happens. I check the email account where it should deliver to and there is no mail. If there is some behind the scenes programming or script that I am missing then I may be in trouble.  I did test this option from your attachment at my desktop and it worked correctly, even opening the email for additional attachments as I hoped. Again, any insight on what I have missed would be greatly appreciated.

Thanks,

Nugget

Avatar

Former Community Member

You would have to send me the form so I can see what is happening .....you can send it to LiveCycle8@gmail.com and I will have a look when I get a chance. Please include a brief description of the issue in the email.

paul

Avatar

Level 1

You never added code to the fake button that clicks the real button.

On the click event of the fake button add this code:

Button2.execEvent("click")

Paul

Paul,

Thanks, I’m very close.

I found how to add the script to the button, and now it generates the email, but I notice that the address shown, mailto:emailaddres@domain.com, in the email that is generated is not the address bound to the drop down list selection that the end user makes. It should generate the address based on the end users selection in the drop down list. There seems to be no connection between the drop down list selection made and the email address that is generated by the "real", (hidden) button. Is ther some script that I have missed in the drop down list ?

Thanks,

Nugget

Avatar

Correct answer by
Former Community Member

That address that is showing up is the one that is hard coded in the real email button. There is some additional code that needs to be added ...so replace the code that you have with this code:

if (EmailAddress.rawValue != null){
Button2.event__click.submit.target = "mailto:" + EmailAddress.rawValue + "?subject=" + Subject.rawValue;
Button2.execEvent("click");
} else {
app.alert("Please enter an email address in the Email field");
}

Then change the email fields name from TextField4[1] to EmailAddress. Now try it again. If you want I can attach the modified version to this thread ...but everyone will be able to see it and get it.

Paul

Avatar

Level 1

Paul,

To clarify, is your reference to "TextField4[1]" a field from the form copy I sent you ? I cannot find this field on my form.

After looking over my form, I see what you are referencing. The source of email choices comes from the form field name "Choose an Engineer to Email" and has the Binding name "DropDownList1" - The code would then probably be different, since the "real email" button is looking to take its cue for a recipient from this drop down list, rather than from the "TextField4[1]" field. Sorry if my questions led astray.

Thanks,

Nugget

Avatar

Former Community Member

Yes .....that was the email address field that was provided in the form.

Paul

Avatar

Level 1

Paul,

Appreciate your patience on this. Form and buttons are still not working correctly. un-sure how to get the "real" button to reflect the end users choice of email recipient from the field titled " Choose an Engineer to email", named "Dropdownlist1". I've sent the most recent copy of the form to you for reference. Thanks again for your assistance.

Nugget

Avatar

Level 1

Paul,

Thanks for the help!

If I understand correctly, The codeing you gave in response "5" just needed to be tailored to the correct buttons, in this case, the coding behind the "fake" button should have been -

if (dropdownlist1.rawValue != null){
Button2.event__click.submit.target = "mailto:" + dropdownlist1.rawValue + "?subject=" + Subject.rawValue;
Button2.execEvent("click");
} else {
app.alert("Please enter an email address in the "Choose an Engineer to email" field");
}

It works perfectly !

Nugget

Avatar

Level 1

Again, Thanks very much.

Are there any scripting / code resources that you would recommend for newbie's ?

Regards,

Nugget

Avatar

Level 1

Forgive my n00bness, I have looked at the example document but I am not quite sure how to create a submit button that will read the submit to email address from an entry made on the form. I want people to enter their supervior's email address, then when finished with the for press the submit to supervisor button. The supervisor will then approve the form and use a submit to HR button. The submit to HR button will use a pre-programmed submit to address, but I would like to have the subject of that email read from the form as well, so the submit to HR button will create a subject with employee name and department name that is read from the same form.

Avatar

Level 1

Paul,

I created a form using a submit button similar to the one "Control email through script" in your sample and it works fine.

The problem I have is when I distribute the form to track the answers.  E-mail, subject and body messages are changed in the *_distributed.pdf form.

Is there any way to distribute the form or tracking the answers keeping the script in the original form?

Thank you.

Aldo

Avatar

Former Community Member

When you use the Distribute form functionality you are leveraging Acrobat.com to track the answers for you. By doing this it puts script into your form so that the emails will go back there. If you want to control this yourself then do not use the Distribute functionality (of course now it is up to you to collect the responses as well).

Hope that helps

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----