function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sf.dev.ax1103sf.dev.ax1103 

Convert Web to Lead form to Visualforce for Sites

Hi All,

  

               I am trying to use sites to post my web to lead form.Is it possible to convert below html code to visualforce  Any help plz. Below is my web to lead form

 

 


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

<input type=hidden name="oid" value="00DT0000000KVU">
<input type=hidden name="retURL" value="http://">

<!--  ----------------------------------------------------------------------  -->
<!--  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>                              -->
<!--  <input type="hidden" name="debugEmail"                                  -->
<!--  value="sai@sftech.com">                               -->
<!--  ----------------------------------------------------------------------  -->

<label for="first_name">First Name</label><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>

<label for="last_name">Last Name</label><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>

<label for="email">Email</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br>

<label for="company">Company</label><input  id="company" maxlength="40" name="company" size="20" type="text" /><br>

<label for="city">City</label><input  id="city" maxlength="40" name="city" size="20" type="text" /><br>

<label for="state">State/Province</label><input  id="state" maxlength="20" name="state" size="20" type="text" /><br>

<input type="submit" name="submit">

</form>

 

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
EIE50EIE50

<input type="hidden" name="oid" value="00DT0000000KVU" />
<input type="hidden" name="retURL" value="http://" />

 

Do the same for your last input tag too, make sure you end your input tag with a,  />

 

Thanks.

All Answers

EIE50EIE50

Hi,

 

All you have to do is, include your html form inside a visualforce page like this,

 

<apex:page>

 

    <!-- your html form goes here -->

 

</apex:page>

 

 

Thanks.

sf.dev.ax1103sf.dev.ax1103

I tried that but gives me many errors.

EIE50EIE50

What errors are you getting? can you post them?

 

Thanks.

sf.dev.ax1103sf.dev.ax1103
ErrorError: Open quote is expected for attribute "type" associated with an element type "input".



EIE50EIE50

you forgot to put the quotes around type attribute iside the input tag.

 

It should be like <input type="hidden" blah balh>

sf.dev.ax1103sf.dev.ax1103

Now i am getting another error.

 

ErrorError: The element type "input" must be terminated by the matching end-tag "</input>".



EIE50EIE50

<input type="hidden" name="oid" value="00DT0000000KVU" />
<input type="hidden" name="retURL" value="http://" />

 

Do the same for your last input tag too, make sure you end your input tag with a,  />

 

Thanks.

This was selected as the best answer
sf.dev.ax1103sf.dev.ax1103

Thanks Buddy that helped me a lot.So here is my version of visual force page for sites.

 

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

<input type="hidden" name="oid" value="00DT0000000KVU"/>
<input type="hidden" name="retURL" value="http://"/>

<!--  ----------------------------------------------------------------------  -->
<!--  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>                              -->
<!--  <input type="hidden" name="debugEmail"                                  -->
<!--  value="sai@sftech.com">                               -->
<!--  ----------------------------------------------------------------------  -->

<label for="first_name">First Name</label><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>

<label for="last_name">Last Name</label><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br/>

<label for="email">Email</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br/>

<label for="company">Company</label><input  id="company" maxlength="40" name="company" size="20" type="text" /><br/>

<label for="city">City</label><input  id="city" maxlength="40" name="city" size="20" type="text" /><br/>

<label for="state">State/Province</label><input  id="state" maxlength="20" name="state" size="20" type="text" /><br/>

<input type="submit" name="submit"/>

</form>
</apex:page>