arun678 Posted September 14, 2017 Share Posted September 14, 2017 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. Quote Link to comment Share on other sites More sharing options...
requinix Posted September 14, 2017 Share Posted September 14, 2017 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? } Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 14, 2017 Share Posted September 14, 2017 Use two submit buttons in the form that have the same name attribute, labelled appropriately. In your php code (above) simply check the value of the submit button to see what you want to do. Quote Link to comment Share on other sites More sharing options...
requinix Posted September 14, 2017 Share Posted September 14, 2017 simply check the value of the submit button to see what you want to do.The problem is getting the form data to both places. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 14, 2017 Share Posted September 14, 2017 Guess I didn't follow his needs. Only looked at the logic of the php script that I assumed was receiving the POST. Well, I have never used Curl, but from looking at the logic, can one not issue two curl sessions? Quote Link to comment Share on other sites More sharing options...
Sepodati Posted September 14, 2017 Share Posted September 14, 2017 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.