I want to post 2 web to lead forms. I believe I need to submit the first form Async according to this code isn't quite working: https://stackoverflow.com/questions/7843355/submit-two-forms-with-one-button


<form name="form1" action="https://test.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST" target = "me1">
<input type="hidden" name="oid" value="00Df00000000001" />

<form name="form2" action="https://test.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST"  >
<input type="hidden" name="oid" value="00Df00000000001" />

<input name="submit" value="Submit Form" onclick="submitForms ()" type="button">


function submitForms(){
    document.forms["form1"].submit(); /* should be Async?*/
  • I'm confused by your question. Could you elaborate on why you need to submit 2 forms from the same button? Are they different Record Type leads (easily handled by rules), do they go to different places or is there something else?
    – crmprogdev
    Oct 27 '14 at 15:11
  • I need two records created in SF when the user clicks the submit button on the W2L. they go to different business processes, and contain different information..... Also, this is the process that has existed in the company for years, and I'm inheriting it. Oct 27 '14 at 15:48
  • Information that goes to custom objects can be submitted directly from the same form. Its in part a matter of editing your rules for leads and changing your workflow. There's also a couple of free apps on the App Exchange that might help make this easier for you. Search using the key word Leads or to find them.
    – crmprogdev
    Oct 27 '14 at 16:59
  • thanks.... I'm reading about Ajax, and would like to try an ajax approach... This is the primer i'm going off of : tutorials2learn.com/tutorials/scripts/ajax-scripts/… Oct 27 '14 at 18:14

You need to make the first call with ajax. Submiting the next from on ajax sucess done event will make sure you are done with the first form post.

  method: "POST",
  url: "", //YOur W2L Url
  data: { name: "John", location: "Boston" } //Your first form data. you can use jquery to retrive data from  your fields
// Make sure you pass the orgid and hidden fields here also.
  .done(function( msg ) {

I hope this helps please comment if you face any issue.


While you can probably do this in Ajax, I think having a PHP (or similar) form that takes the data and then creates two Leads in Salesforce via the API or CURL is the right answer.

I've seen a lot of people send data from plain old HTML forms to their PHP form engine, and do all sorts of creative things with them there, commonly passing them to a CMS and Salesforce. But I suppose passing them to Salesforce twice would be just as easy.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.