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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.