Highlighted

Submit button sends e-mail AND goes to a URL?

BJeppson

03-03-2009

I have a button on a form that I would like to do two things: send the form to an e-mail address and then (or at the same time) send the user to a URL. It's a registration form and I want completed for to go to one person and then the user be redirected to our unique https PayPal site to pay for registration.



Thanks for any help.

Replies

Highlighted

pguerett

04-03-2009

You could put a hidden button on the form to do the email and have a visible button that woudl click the hidden button (to cause the email to be sent) then have it redirect to the URL.
Highlighted

BJeppson

04-03-2009

Okay, Paul, so you're saying that one button is on top of the other so that when it's clicked both actions occur? This doesn't seem to work. What am I missing from your answer?
Highlighted

pguerett

05-03-2009

There can only be one event when a button is clicked so no you do not have to put on eon top of the other. But you can hide the mail button (anywhere on the page), then on the click event of the other button programmatically click the mail button:



emailButton.execEvent("click")



Then do the redirect to the URL.
Highlighted

BJeppson

05-03-2009

I guess I'm confused about where to put the event and the correct syntax, because I keep getting an error. Here is the event code for the non-hidden button. For testing, the e-mail address can be buck@buckleyjeppson.com. Can you give me the whole correct line and placement so I can learn how to do this sort of thing in the future?<br /><br /><event activity="click" name="event__click"><br /> <submit format="urlencoded" textEncoding="UTF-16" target="http://www.buckandmike.com"/> <br /> </event><br /> </field><br /> <?templateDesigner expand 1?>
Highlighted

pguerett

06-03-2009

You are showing a snippet of the XDP file .....you can highlight the visible button, then look in the script editor. You can choose the event that you want to code against (in the dropdown at the top right). In your case choose click. Your code should be there.
Highlighted

BJeppson

06-03-2009

Paul, I can't choose click because this the visible button is a submit button (it has to be so it redirects to HTTP). According to the Help it must go in the preSubmit. Below is the line. I don't understand where to put the emailButton.execEvent("click") code in relation to this.



form1.#subform[0].Button2::preSubmit:form - (JavaScript, client)



I'm sorry to be dense. I'm trying to learn the basics here.
Highlighted

pguerett

06-03-2009

Lets start from scratch.



1. Put a submit button on the form and set it up to submit the way you want.

2. Make the submit button invisible (not hidden).

3. Add a regular button. Change the caption to say whatever you want to cause the user to press it when they are compelete and want to submit.

4. Highlight the regular button.

5. Open the script editor - On the top left choose the Click event, on the far right choose Javascript as the language

6. A line will appear in the script editor indicating the object name and the event that is being coded against.

7. Put the cursor below that line.

8. Add the code to call the real submit button:



submitButtonName.execEvent("click");



9. Move the cursor to the next line.

10. Add the line of code to launch the URL:



app.launchURL("http://www.adobe.com");

11. Test this
Highlighted

BJeppson

06-03-2009

I get the following error:



Script failed (language is formcalc; context is xfa[0].form1[0].#subform[0].ButtonName.execEvent("click);

app.launchURL("http://www.adobe.com");



Error: accessor 'submitButtonName.execEvent("click")' is unknown.



Changing the language to Javascript doesn't give the error, but nothing happens on the click.