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
Del_SantosDel_Santos 

Field values in Sites not passing to Lead object

Hi Guys,

 

I have a force.com site which pass the value automatically of my inputfield to sfdcLead when i click submit.

 

I changed my design not to use an inputfield because of some limitations. I changed my code as below. However when i click on submit, it does not pass the value to my lead object anymore. Please help me. Thanks!

 

<apex:pageBlockSection title="Installation Address" collapsible="false" columns="1">
        <label for="{!Lead.Installation_House__c}">Installation House </label>
            <input type="text" name="{!Lead.Installation_House__c}" id="insthouse"/><br></br>
        <label for="{!Lead.Installation_Apartment__c}">Installation Apartment </label>
            <select id="instapt" name="{!Lead.Installation_Apartment__c}" size="1">
                <option value="EastwoodParkview1">Eastwood Parkview 1</option>
                <option value="EastwoodParkview2">Eastwood Parkview 1</option>
                <option value="OneCentralPark">One Central Park</option>
            </select><br></br>     
        <label for="{!Lead.Installation_Street__c}">Installation Street </label>   
            <input type="text" name="{!Lead.Installation_Street__c}" id="instst"/><br></br>
        <label for="{!Lead.Installation_House__c}">Installation Subdivision </label> 
            <input type="text" name="{!Lead.Installation_Subdivision__c}" id="instsubd"/><br></br>
        <label for="{!Lead.Installation_City__c}">Installation City </label>
            <input type="text" name="{!Lead.Installation_City__c}" id="instcity"/><br></br>
        <label for="{!Lead.Installation_Zipcode__c}">Installation Zipcode </label>
            <input type="text" name="{!Lead.Installation_Zipcode__c}" id="instzip"/><br></br>
</apex:pageBlockSection>

 

 

Thanks!

Del

Navatar_DbSupNavatar_DbSup

Hi,

 

Use the <apex:inputtext/ > instead of   <input type="text" .

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

Del_SantosDel_Santos

Hi Ankit,

 

Thanks for the suggestion. However, i am using <input type="text"  because i am using this for my function to disable this field and copy values from another field. See below codes. if i will be using a <apex:inputtext/  would below function will still applicable?

 

Thanks!

Del

 

 

 

 

=======================================

 

<script language="Javascript">
function FillBillingAddress(f) {
var Copy= document.getElementById('copy');
var Insthouse= document.getElementById('insthouse');
var Billhouse= document.getElementById('billhouse');
if(f.copy.checked == true){
    f.billhouse.value = f.insthouse.value; 
    f.billhouse.disabled = true;
    f.billapt.value = f.instapt.value;
    f.billapt.disabled = true;
    f.billst.value = f.instst.value;
    f.billst.disabled = true;
    f.billsubd.value = f.instsubd.value;
    f.billsubd.disabled = true;
    f.billcity.value = f.instcity.value;
    f.billcity.disabled = true;
    f.billzip.value = f.instzip.value;
    f.billzip.disabled = true; 
  }
  else
  {
  f.billhouse.disabled = false;
  f.billhouse.value = "";
  f.billapt.disabled = false;
  f.billapt.value = "";
  f.billst.disabled = false;
  f.billst.value = "";
  f.billsubd.disabled = false;
  f.billsubd.value = "";
  f.billcity.disabled = false;
  f.billcity.value = "";
  f.billzip.disabled = false;
  f.billzip.value = "";
  }
}
</script>


<apex:pageBlockSection title="Installation Address" collapsible="false" columns="1">
       <apex:inputText value="{!Lead.Installation_House__c}" id="insthouse"/><br></br>
         <label for="{!Lead.Installation_House__c}">Installation House </label>
             <input type="text" name="{!Lead.Installation_House__c}" id="insthouse"/><br></br>
            <label for="{!Lead.Installation_Apartment__c}">Installation Apartment </label>
            <select id="instapt" name="{!Lead.Installation_Apartment__c}" size="1">
                <option value="EastwoodParkview1">Eastwood Parkview 1</option>
                <option value="EastwoodParkview2">Eastwood Parkview 1</option>
                <option value="OneCentralPark">One Central Park</option>
            </select><br></br>     
            <label for="{!Lead.Installation_Street__c}">Installation Street </label>   
            <input type="text" name="{!Lead.Installation_Street__c}" id="instst"/><br></br>
            <label for="{!Lead.Installation_House__c}">Installation Subdivision </label> 
            <input type="text" name="{!Lead.Installation_Subdivision__c}" id="instsubd"/><br></br>
            <label for="{!Lead.Installation_City__c}">Installation City </label>
            <input type="text" name="{!Lead.Installation_City__c}" id="instcity"/><br></br>
            <label for="{!Lead.Installation_Zipcode__c}">Installation Zipcode </label>
            <input type="text" name="{!Lead.Installation_Zipcode__c}" id="instzip"/><br></br>
</apex:pageBlockSection>               
       
<apex:pageBlockSection title="Billing Address" collapsible="false" columns="1">
<input type="checkbox" name="{!Lead.Cpy_from_Installation_Address__c}" onclick="FillBillingAddress(this.form)"

id="copy"/>
<font color="red"><em>Check this box if Billing Address and Mailing Address are the same.</em></font>
<P></P>
        <label for="{!Lead.Billing_House__c}">Billing House </label>
        <input type="text" name="{!Lead.Billing_House__c}" id="billhouse"/><br></br>
        <label for="{!Lead.Billing_Apartment__c}">Billing Apartment </label>
        <input type="text" name="{!Lead.Billing_Apartment__c}" id="billapt"/><br></br>
        <label for="{!Lead.Billing_Street__c}">Billing Street </label>
        <input type="text" name="{!Lead.Billing_Street__c}" id="billst"/><br></br>
        <label for="{!Lead.Billing_Subdivision__c}">Billing Subdivision </label>
        <input type="text" name="{!Lead.Billing_Subdivision__c}" id="billsubd"/><br></br>
        <label for="{!Lead.Billing_City__c}">Billing City </label>
        <input type="text" name="{!Lead.Billing_City__c}" id="billcity"/><br></br>
        <label for="{!Lead.Billing_Zip_code__c}">Billing Zipcode </label>
        <input type="text" name="{!Lead.Billing_Zip_Code__c}" id="billzip"/>
</apex:pageBlockSection> 

Navatar_DbSupNavatar_DbSup

Hi,

 

Yes,You can access the <Apex:inputtext/> values in javascript .

 

In javascript you have to pass whole xml tree id to get the value.

 

For example

document.getElementById('{!$Component.apexpageid.apexformid.textbox.id}’)

 

 

Del_SantosDel_Santos

Hi Ankit,

 

I am struggling to get this working. I used below codes but no luck. can u help on this? Thanks!!

 

<script language="Javascript">

function FillBillingAddress(f) {

var Copy= document.getElementById('{!$Component.thePage.theForm.copy}’);
var Insthouse= document.getElementById('{!$Component.thePage.theForm.insthouse}’);
var Billhouse= document.getElementById('{!$Component.thePage.theForm.billhouse}’);
if(f.copy.checked == true){
    f.billhouse.value = f.insthouse.value; 
    f.billhouse.disabled = true;
  }
  else
  {
  f.Billhouse.disabled = false;
  f.Billhouse.value = "";
 
  }
}
</script>

<apex:pageBlock>
<apex:pageBlockSection title="Installation Address" collapsible="false" columns="1">
             <apex:inputText value="{!Lead.Installation_House__c}" id="insthouse"/><br></br>
           <br></br>
</apex:pageBlockSection>               
       
<apex:pageBlockSection title="Billing Address" collapsible="false" columns="1">
<apex:inputCheckbox value="{!Lead.Cpy_from_Installation_Address__c}" onclick="FillBillingAddress(this.form)" id="copy"/>
<font color="red"><em>Check this box if Billing Address and Mailing Address are the same.</em></font>
<P></P>
        <apex:inputText value="{!Lead.Billing_House__c}" id="billhouse"/><br></br>
</apex:pageBlockSection> 
</apex:pageBlock>

 

 

Del