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
Sameer TyagiSameer Tyagi 

Need to Create a Common HTML page for Web to lead and Web to Case

HI, I need help. 

I copied pregenerated html pages from web to lead and web to case and merge it... 
but I able to create only lead with this code. 
I am trying to change it with a picklist 



<html>
<body onload="onloadmethod();">


<script type="text/javascript">
function myFunction(optype )
{
     console.log('test');

   if(optype == "4"){
     document.getElementById('lead').style.visibility='visible';  
     document.getElementById('case').style.visibility='hidden';
     document.getElementById('Theform').action = 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';
      
   }
    else {
document.getElementById('lead').style.visibility='hidden';
        document.getElementById('case').style.visibility='visible';
document.getElementById('Theform').action= 'https://www.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8';


   }
}

     function onloadmethod(){
  document.getElementById('lead').style.visibility='hidden';
 
     }
</script>

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

<form id = "Theform" action="" method="POST">

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

</br>

<center><label >Type of Request</label>&nbsp;&nbsp;

<select  onchange = "myFunction(this.value);">

  <option value="2">Message</option>
  <option value="3">I will miss a lesson</option>
  <option value="4">New Student Enquiry/Registration Request</option>
  <option value="5">I want to be in the band</option>
  <option value="6">Transfer/New Time Request</option>
  <option value="7">Cancel/Drop Lesson</option>
</select></br></br></center>

<div id = "lead">
<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">
</div>


<div id = "case">

<label for="name">Contact Name</label><input  id="name" maxlength="80" name="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="phone">Phone</label><input  id="phone" maxlength="40" name="phone" size="20" type="text" /><br>

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

<label for="description">Description</label><textarea name="description"></textarea><br>

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

</div>



</form

</body>
</html>

==========

Your help would be appricated. 

sandeep@Salesforcesandeep@Salesforce
As per current scenario you should use <apex:selectList> tag to create pick list and then accordingly you can insert Lead or Case.
Sameer TyagiSameer Tyagi
HI Sandeep , I am not using Visual force page. Its an Simple HTML page.