Jump to content

One submit button , Two actions


arun678

Recommended Posts

Requirement:

 

I have a drupal website, wherein i have to use single form for two purpose.

1) Send lead source(which is a parameter) to Salesforce Platform:

that is one url: say for eg: https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8

 

2) Send the same form values to another URL which is actually for sign up on Salesforce Platform:

"same form values are used by salesforce to email the user, so that he can sign up, that's a different story"

this is second url: say for eg: http://www.salesforce.com/leadcapture/PartnerSignupServlet

 

Difficulty:

Now i have one form. but when user submits the form it has to go to both URLs which is actually not happening.

 

 

Please help me with this.

 

 

 

Link to comment
Share on other sites

You can't do it like that: a form can only submit to one location.

 

You could submit the form to your own site, then do the two form submissions from your own server - if that's allowed by Salesforce, of course.

Looks like

<form action="/path/to/some/script.php" method="post">
<?php

if (/* form was submitted, is valid, etc. */) {
	$curl = curl_init("https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8");
	// set curl options here...
	curl_exec($curl);
	curl_close($curl);

	$curl = curl_init("http://www.salesforce.com/leadcapture/PartnerSignupServlet");
	// another set of options...
	curl_exec($curl);
	curl_close($curl);

	// then display a page or redirect or whatever
} else {
	// error?
}
Link to comment
Share on other sites

Well, I have never used Curl, but from looking at the logic, can one not issue two curl sessions?

The assumption is that the first place to post would be the owner's PHP script. So you'd only need to "fake" a POST to the Salesforce page.

 

I'd do them both with jQuery on the same button action and display a success/fail message for each one.

 

-John

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.