Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple form submission...or loop?

Status
Not open for further replies.

mamabird

Programmer
Dec 19, 2006
15
US
I have a page that lists several papers that users need to register for (through salesforce.com) There is one registration form and 3 buttons ("get doc 1", "get doc 2", "get both docs". Since this is set up through salesforce there are 2 items I cannot change:
Code:
<form action="[URL unfurl="true"]https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8"[/URL] method="POST" name="register" id="register">

and

<input id="00N70000001hRPE" title="Lead Source Detail" name="00N70000001hRPE" type="hidden" value="[registered paper name]" />

Most of the pages only have 1 paper to register for which this works for just fine. The "Lead Source Detail" input form must have the id/name listed above and there cannot be 2. I tried adding another line, just changing the value, but the way salesforce processes this is to stop processing once it gets meets the first rule (in this case, sending out the 1st paper). It sends the user the paper, captures the lead detail and routes the user back to a returnURL of my choice.

I thought about submitting the form and having the returnURL come back with url params to feed back into another form submission, etc. The problem is that down the road my manager wants the user to be able to select as many papers as they want and do a single submission, so I can't possible hard code all the scenarios.

I have routed the form page to a test page, where I have a series of (isset ($_POST['submit_name'])) if statements, and I have created a form from each one. So now I have 3 independent forms on the page and would like to just submit all 3 at the same time. Can this be done?

Any other creative ideas for handling this? Many apologizes for the long-winded explanation...I hope I've made myself clear!
 
You could use javascript to submit all 3 forms at once, though I don't know if sales force will allow multiple simultaneous submissions from the same location.

You can have JS submit unto another window so whatever sales force does it does in another window, and once its done redirect to one of your scripts that closes the page and sends a value to your submission page so it sends the next form, and marks the previous one as sent.

Of course this is all Javascript rather than PHP.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I would not depend on javascript to be enabled on the client.

You may want to check out the curl extension. Curl is a library to do http and ftp requests and read the results). If you use curl, your user submits any info he likes (say, 3 documents) to your server and your server then processes this into the 3 request your server makes to salesforce.com using curl. Off course, you will have to process the answers and do the return ("thank you") page as well.

One more thing: if salesforce uses https because of payments, you should use https as well (otherwise criminals could see the payment details).

+++ Despite being wrong in every important aspect, that is a very good analogy +++
Hex (in Darwin's Watch)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top