SFDC VisualForce Page pageblocksection example

SFDC-VisualForce-Page-Example-SAVE



<apex:page standardController="Contract_Addendum__c">
<apex:pagemessages />

<script>

function checkedOverride()
{
    var isChecked =  document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.Override_Interest__c}').checked ;
    
    if(isChecked)
    {   
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.LPC_Percent_Charge__c}').disabled = false;
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.Prime_Source__c}').disabled = false;
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.Bill_When__c}').disabled = false;

    }
    else
    {
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.LPC_Percent_Charge__c}').disabled = true;
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.LPC_Percent_Charge__c}').value ="";
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.Prime_Source__c}').disabled = true;
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.Prime_Source__c}').value = "";
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.Bill_When__c}').disabled = true;
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.Bill_When__c}').value = "";
    }
}

function legalClause()
{
    
    var selObj = document.getElementById('{!$Component.frm1.pblock.PBlockSectionBEA.Start_Date_c__c}');
 
    var i;
    var count = 0;
    for (i=0; i<selObj.options.length; i++) {
      
      if (selObj.options[i].selected)
      {
        if (selObj.options[i].value == 'Add/Delete Language')
        {
            count++;
        }   
      }
      
    }
    
    //alert('Count => ' + count);
    if (count>0)
    {
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionBEA.Usage_Tolerance__c}').disabled = false;
        
        if (document.getElementById('{!$Component.frm1.pblock.PBlockSectionBEA.Usage_Tolerance__c}').value=="")
        {
            document.getElementById('{!$Component.frm1.pblock.PBlockSectionBEA.Usage_Tolerance__c}').value = "5";
        }    
    }
    else
    {
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionBEA.Usage_Tolerance__c}').disabled = true;
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionBEA.Usage_Tolerance__c}').value = "";
    }
    
}

window.onload=function()
{
    if(!document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.Override_Interest__c}').checked)    
    {
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.LPC_Percent_Charge__c}').disabled = true;
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.Prime_Source__c}').disabled = true;
        document.getElementById('{!$Component.frm1.pblock.PBlockSectionEnrollment.Bill_When__c}').disabled = true;
    }
        
    legalClause();
}
</script>


<apex:form id="frm1">    
{!$CurrentPage.parameters.RecordType}

{!LEFT(Contract_Addendum__c.RecordTypeId,15)}

{!Contract_Addendum__c.RecordTypeId}

<apex:pageBlock title="Contract Addendum" mode="inlineEdit" id="pblock" rendered="{!LEFT(Contract_Addendum__c.RecordTypeId,15)!='01230000000qxce'}"> 

<apex:pageBlockButtons >
    <apex:commandButton value="Save" action="{!save}"/>
    <apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
      

<apex:pageblocksection id="PBlockSectionBEA" columns="2" title="BEA">  
    <apex:inputField value="{!Contract_Addendum__c.Contract_Addendum_Owner__c}" required="false"/> 
    <apex:inputField value="{!Contract_Addendum__c.Customer_Negotiated_Contract__c}" required="false"/> 
    <!-- Legal Entity Name Change -->
    <apex:inputField value="{!Contract_Addendum__c.New_Legal_Entity_Name__c}" required="true" rendered="{!LEFT(Contract_Addendum__c.RecordTypeId,15)=='01230000000qxce'}"/>
    <apex:outputText rendered="{!Contract_Addendum__c.RecordTypeId=='01230000000qxceAAA'}">&nbsp;</apex:outputText>    
    <!-- Legal Entity Name Change -->
    
    <apex:inputField value="{!Contract_Addendum__c.Opportunity__c}" required="false"/>
    <apex:inputField value="{!Contract_Addendum__c.Commercial_Contract__c}" required="true"/>
    <!-- Assignment Type -->
    <apex:outputText rendered="{!LEFT(Contract_Addendum__c.RecordTypeId,15)=='01230000000qxcb'}">&nbsp;</apex:outputText>
    <apex:inputField value="{!Contract_Addendum__c.Assignment_Type__c}" required="true" rendered="{!LEFT(Contract_Addendum__c.RecordTypeId,15)=='01230000000qxcb'}"/>
    <!-- Assignment Type -->
    <apex:inputField value="{!Contract_Addendum__c.DBA__c}" required="false"/>    
    <apex:inputField value="{!Contract_Addendum__c.Status__c}" required="false"/>
    <apex:inputField value="{!Contract_Addendum__c.Broker_Name__c}" required="false"/> 
    <apex:inputField value="{!Contract_Addendum__c.Contract_Term__c}" required="true"/> 
    <apex:inputField value="{!Contract_Addendum__c.Agent_Name__c}" required="false"/> 
    <apex:inputField value="{!Contract_Addendum__c.Monthly_Usage_kWh__c}" required="true"/> 
    <apex:inputField value="{!Contract_Addendum__c.Billing_Street__c}" required="true"/> 
    <apex:inputField value="{!Contract_Addendum__c.Summed_UAN_Estimated_Monthly_Usage_kWh__c}" required="false"/>
    <apex:inputField value="{!Contract_Addendum__c.Billing_City__c}" required="true"/> 
    <apex:inputField value="{!Contract_Addendum__c.Contract_Start_Month__c}" required="true"/>     
    <apex:inputField value="{!Contract_Addendum__c.Billing_State__c}" required="true"/>
    <apex:inputField value="{!Contract_Addendum__c.Contract_Start_Year__c}" required="true"/>     
    <apex:inputField value="{!Contract_Addendum__c.Billing_Postal_Code__c}" required="true"/>  
    <apex:inputField value="{!Contract_Addendum__c.Contract_PDF__c}" required="false"/>

    <!-- Legal Clause -->
    <apex:inputField value="{!Contract_Addendum__c.Start_Date_c__c}" required="false" id="Start_Date_c__c" onchange="legalClause();"/>
    <apex:inputField value="{!Contract_Addendum__c.Deal_Capture_Contract_ID__c}" required="false"/>
    <apex:inputField value="{!Contract_Addendum__c.Usage_Tolerance__c}" required="false" id="Usage_Tolerance__c"/>
    <apex:inputField value="{!Contract_Addendum__c.Wet_Signature_Date__c}" required="false"/>
    
    <!-- Assignment Type -->
    <apex:outputText rendered="{!LEFT(Contract_Addendum__c.RecordTypeId,15)=='01230000000qxcb'}">&nbsp;</apex:outputText>
    <apex:inputField value="{!Contract_Addendum__c.Effective_Date__c}" required="true" rendered="{!LEFT(Contract_Addendum__c.RecordTypeId,15)=='01230000000qxcb'}"/>    
    <!-- Assignment Type -->

    <apex:inputField value="{!Contract_Addendum__c.Prepaid_Percentage__c}" required="false"/>
    <apex:inputField value="{!Contract_Addendum__c.Executed_BEA_Date__c}" required="true"/>      
    
</apex:pageblocksection>

<!-- Price/Product Conversion -->
<apex:pageBlockSection columns="1" id="priceProductConversion" rendered="{!LEFT(Contract_Addendum__c.RecordTypeId,15)=='01230000000qxcf'}">
<apex:inputField value="{!Contract_Addendum__c.BEA_Initial_Term_End__c}" required="false"/>
<apex:inputField value="{!Contract_Addendum__c.BEA_Initial_Term_Unchanged__c}" required="false"/>
</apex:pageBlockSection>   
<!-- Price/Product Conversion -->       

<apex:pageBlockSection columns="2" id="dataRepair" rendered="{!LEFT(Contract_Addendum__c.RecordTypeId,15)=='012a0000001NODO'}">
<apex:inputField value="{!Contract_Addendum__c.Data_Repair_Ticket_Number__c}" required="true"/>
</apex:pageBlockSection>   

<apex:pageblocksection id="PBlockSectionEnrollment" columns="2" title="Enrollment">
    <apex:inputField id="LPC_Percent_Charge__c" value="{!Contract_Addendum__c.LPC_Percent_Charge__c}" required="false"/>
    <apex:inputField value="{!Contract_Addendum__c.Notification_Waiver__c}" required="false"/>
    <apex:inputField id="Prime_Source__c" value="{!Contract_Addendum__c.Prime_Source__c}" required="false"/>    
    <apex:inputField id="Override_Interest__c" onclick="checkedOverride();" value="{!Contract_Addendum__c.Override_Interest__c}" required="false"/>    
    <apex:outputText >&nbsp;</apex:outputText>
    <apex:inputField id="Bill_When__c" value="{!Contract_Addendum__c.Bill_When__c}" required="false"/>   
</apex:pageblocksection>    

<apex:pageblocksection columns="2" title="Product/Pricing Information">
    <apex:inputField value="{!Contract_Addendum__c.Product_Request_ID__c}" required="false"/>
    <apex:inputField value="{!Contract_Addendum__c.CA_Inbox_Timestamp__c}" required="false"/>
</apex:pageblocksection>    

<apex:pageblocksection columns="2" title="Margin Analysis">
    <apex:inputField value="{!Contract_Addendum__c.Customer_Rate_kWh__c}" required="false"/>
    <apex:inputField value="{!Contract_Addendum__c.UAN_Usage_Zone_J_Dual_Billing__c}" required="false"/>
    <apex:inputField value="{!Contract_Addendum__c.Total_Cost__c}" required="false"/>
    <apex:inputField value="{!Contract_Addendum__c.UAN_Usage_Zone_J__c}" required="false"/>      
    <apex:inputField value="{!Contract_Addendum__c.Other_Margin__c}" required="false"/>
    <apex:inputField value="{!Contract_Addendum__c.UAN_Usage_Zone_Other__c}" required="false"/>      
    <apex:inputField value="{!Contract_Addendum__c.Broker_Margin__c}" required="false"/>
</apex:pageblocksection>    

</apex:pageBlock>
    
</apex:form>    

</apex:page>

Print Friendly, PDF & Email
This entry was posted in Development. Bookmark the permalink.