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
jrobidajrobida 

I need help with this If statement

I need when the billing Shipping number is null not to show up on the page.




<apex:page standardController="OrderHeader__c" showHeader="true"> <apex:form id="pgform" > <apex:pageBlock title="Edit Order {!OrderHeader__c.Name}" id="thePageBlock" mode="edit"> <apex:pageMessages /> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Order Information" showHeader="false" columns="2"> <apex:inputField value="{!OrderHeader__c.AccountingCustomerId__c}"/> <apex:inputField value="{!OrderHeader__c.SalespersonId__c}"/> <apex:inputField value="{!OrderHeader__c.Type__c}"/> <apex:inputField value="{!OrderHeader__c.Sales_Engineer__c}"/> <apex:inputField value="{!OrderHeader__c.CreditTerms__c}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Shipping and Fulfillment Information" showHeader="true" id="ShippingSection"> <apex:inputField value="{!OrderHeader__c.ShippingMethodId__c}"/> <apex:inputField value="{!OrderHeader__c.ChargeShipping__c}"/> <apex:inputField value="{!OrderHeader__c.ShipNumber__c}" id="Shipping"/> <apex:inputField value="{!OrderHeader__c.ShipProducts__c}"/> [<a href="#" onclick="document.getElementById('j_id0:pgform:thePageBlock:ShippingSection:Shipping').value='';">PVSW FedEx</a>] | [<a href="#" onclick="document.getElementById('j_id0:pgform:thePageBlock:ShippingSection:Shipping').value='';">PVSW DHL</a>] | {!IF(OrderHeader__c.AccountingCustomerId__r.DefaultShippingNumber__c= "",(<a href="#" onclick="document.getElementById('j_id0:pgform:thePageBlock:ShippingSection:Shipping').value='{!OrderHeader__c.AccountingCustomerId__r.DefaultShippingNumber__c}';">Customer Shipping Number</a>),""))} </apex:pageBlockSection> <apex:pageBlockSection title="Tax Settings" showHeader="true" columns="1"> <apex:inputField value="{!OrderHeader__c.ChargeTax__c}"/> <apex:inputField value="{!OrderHeader__c.TaxNumber__c}"/> <apex:inputField value="{!OrderHeader__c.VAT__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

Best Answer chosen by Admin (Salesforce Developers) 
jrobidajrobida

This is how I got this to work

 

 <apex:outputLink rendered="{!NOT(OrderHeader__c.AccountingCustomerId__r.DefaultShippingNumber__c='')}" value="javascript&colon;document.getElementById('j_id0:pgform:thePageBlock:ShippingSection:Shipping').value='{!OrderHeader__c.AccountingCustomerId__r.DefaultShippingNumber__c}';">Customer Shipping Number</apex:outputLink>

 

All Answers

jd123jd123

Hi 

 

I Didn't understand your question properly.You don't want to display your page or portion page please let me know if anything is worng

 

 

<apex:page standardController="OrderHeader__c" showHeader="true" rendered="{!OrderHeader__c.ShipNumber__c!=null> 
<apex:form id="pgform" >      
  <apex:pageBlock title="Edit Order {!OrderHeader__c.Name}" id="thePageBlock" mode="edit">
            <apex:pageMessages />
            
                <apex:pageBlockButtons >
                    <apex:commandButton value="Save" action="{!save}"/>
                    <apex:commandButton value="Cancel" action="{!cancel}"/>                
                </apex:pageBlockButtons>

            <apex:pageBlockSection title="Order Information" showHeader="false" columns="2">
                <apex:inputField value="{!OrderHeader__c.AccountingCustomerId__c}"/>
                <apex:inputField value="{!OrderHeader__c.SalespersonId__c}"/>
                <apex:inputField value="{!OrderHeader__c.Type__c}"/>
                <apex:inputField value="{!OrderHeader__c.Sales_Engineer__c}"/>
                <apex:inputField value="{!OrderHeader__c.CreditTerms__c}"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Shipping and Fulfillment Information" showHeader="true" id="ShippingSection">
                <apex:inputField value="{!OrderHeader__c.ShippingMethodId__c}"/>            
                <apex:inputField value="{!OrderHeader__c.ChargeShipping__c}"/>
                <apex:inputField value="{!OrderHeader__c.ShipNumber__c}" id="Shipping"/>
                <apex:inputField value="{!OrderHeader__c.ShipProducts__c}"/>
                
                [<a href="#" onclick="document.getElementById('j_id0:pgform:thePageBlock:ShippingSection:Shipping').value='';">PVSW FedEx</a>]
                |
                [<a href="#" onclick="document.getElementById('j_id0:pgform:thePageBlock:ShippingSection:Shipping').value='';">PVSW DHL</a>]
                |
               {!IF(OrderHeader__c.AccountingCustomerId__r.DefaultShippingNumber__c= "",(<a href="#" onclick="document.getElementById('j_id0:pgform:thePageBlock:ShippingSection:Shipping').value='{!OrderHeader__c.AccountingCustomerId__r.DefaultShippingNumber__c}';">Customer Shipping Number</a>),""))}
                
          </apex:pageBlockSection>
          
          
            <apex:pageBlockSection title="Tax Settings" showHeader="true" columns="1">
                <apex:inputField value="{!OrderHeader__c.ChargeTax__c}"/>
                <apex:inputField value="{!OrderHeader__c.TaxNumber__c}"/>
                <apex:inputField value="{!OrderHeader__c.VAT__c}"/>
            </apex:pageBlockSection>

        </apex:pageBlock>


 

If it answer for your question please mark it as resoved.

jrobidajrobida
[<a href="#" onclick="document.getElementById('j_id0:pgform:thePageBlock:ShippingSection:Shipping').value='';">PVSW FedEx</a>]
                |
                [<a href="#" onclick="document.getElementById('j_id0:pgform:thePageBlock:ShippingSection:Shipping').value='';">PVSW DHL</a>]
                |
               {!IF(OrderHeader__c.AccountingCustomerId__r.DefaultShippingNumber__c= "",(<a href="#" onclick="document.getElementById('j_id0:pgform:thePageBlock:ShippingSection:Shipping').value='{!OrderHeader__c.AccountingCustomerId__r.DefaultShippingNumber__c}';">Customer Shipping Number</a>),""))}

 

This bit of code put links on the VF page. I dont want one of the links to show if the data it's pulling from is Null. I still want the rest of the page to show just not this one link.

 

[<a href="#" onclick="document.getElementById('j_id0:pgform:thePageBlock:ShippingSection:Shipping').value='{!OrderHeader__c.AccountingCustomerId__r.DefaultShippingNumber__c}';">Customer Shipping Number</a>]

 

jrobidajrobida

This is how I got this to work

 

 <apex:outputLink rendered="{!NOT(OrderHeader__c.AccountingCustomerId__r.DefaultShippingNumber__c='')}" value="javascript&colon;document.getElementById('j_id0:pgform:thePageBlock:ShippingSection:Shipping').value='{!OrderHeader__c.AccountingCustomerId__r.DefaultShippingNumber__c}';">Customer Shipping Number</apex:outputLink>

 

This was selected as the best answer
jrobidajrobida

Thank for the help