+ Start a Discussion

Web-to-lead not redirecting properly

I've setup web-to-lead and it all seems to be working, except the redirect. When I click Submit, the lead data is sent to my org, and then it opens a new tab and redirects to the URL defined. However, the original page is still there with all of the fields still filled. I want the redirect to happen on the original page, not a new tab.

I'm not sure what I've done wrong. Below is my code. I tried this on multiple computers (mac/pc) and browsers (chrome, safari, ff) - all with the same results above. Any ideas?


<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <META> element to your page <HEAD>.      -->
<!--  If necessary, please modify the charset parameter to specify the        -->
<!--  character set of your HTML page.                                        -->
<!--  ----------------------------------------------------------------------  -->

<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <FORM> element to your page.             -->
<!--  ----------------------------------------------------------------------  -->

<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">

<input type=hidden name="oid" value="00D50000000JOCj">
<input type=hidden name="retURL" value="http://www.eversauce.com">
<input type="hidden" name="lead_source" value="web"/>

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: These fields are optional debugging elements. Please uncomment    -->
<!--  these lines if you wish to test in debug mode.                          -->
<!--  <input type="hidden" name="debug" value=1>                              -->
<!--  ----------------------------------------------------------------------  -->

<p><span style="font-size: small;"><b><label for="first_name">First Name</label></b></span><br /><input id="first_name" type="text" name="first_name" size="20" maxlength="40" /></p>
<p><span style="font-size: small;"><b><label for="last_name">Last Name</label></b></span><br /><input id="last_name" type="text" name="last_name" size="20" maxlength="80" /></p>
<p><span style="font-size: small;"><b><label for="email">Email</label></b></span><br /><input id="email" type="text" name="email" size="20" maxlength="80" /></p>
<p><span style="font-size: small;"><b><label for="phone">Phone</label></b></span><br /><input id="phone" type="text" name="phone" size="20" maxlength="40" /></p>
<p><span style="font-size: small;"><b><label for="company">Company</label></b></span><br /><input id="company" type="text" name="company" size="20" maxlength="40" /></p>
<p><span style="font-size: small;"><b><label for="description">Comment</label></b></span><br /><textarea name="description"></textarea></p>
<p><input type="submit" name="submit" /></p>

Raghavendra ARaghavendra A
Hi Sati,

I have tried the same code from my local system. You would have got two new leads starting with name Test SF Developer. In firefox the website opened in a new tab. But in Internet Explorer the website was opened in the same tab overriding the web to lead form.

So it depends on the brwoser settings on how new links are opened in the browser. A new tab or a new window or in the same tab.

Please check your browser settings.

Let me know if you need more help.

Hi Raghu, But does that mean only people who use IE who use my site will not run into this problem? That won't work. Seems like standard SFDC feature that should work in all common browsers. Thanks, Sati
Also, it's worth noting that if I take the same code and put it in a raw text file, save it as HTML, and then open in a brower, it all seems to work perfectly. It seems the moment I put the code in a google site, it acts funny.
Raghavendra ARaghavendra A
Hi Sathi,

It is not with respect to salesforce functionality. It is with respect to the browser settings. I did not mean specifically for IE, you cna check your browser settings on all other browsers as well.

Since you have added the same to google site, its the combination of browser settings and how google sites open new links.

Please check the browser settings and let me know if you need more help.

I got it working, I added target="_self" to the form action and voila!
Cynde LingamfelterCynde Lingamfelter
I added target="_self", but it's still opening a new tab and the form tab still shows the customer's information as if they didn't click on submit.

<form action="https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" target=“_self” method="POST">

<div class="form-style-5">

<input type=hidden name="oid" value="00D1N000002Lq07">
<input type=hidden name="retURL" value="http://righthandrobotics.com/thankyou">