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
Sid LightningSid Lightning 

Display field in form(PDF) only if its value is filled ?

Hi,

I have a field called Discount... However what really happens is if a customer sees a discount field on final print page with a value of "0" , they become skeptical about a possible discount.

What I really want is if the discount field is greater than 0 or lets say just filled only then it gets displayed in the final screen, if there is no discount or value is 0. it should not get displayed in final form
Best Answer chosen by Sid Lightning
Ramesh DRamesh D
You can use rendered={!fieldvalue="value"} to acheive this
<apex:pageBlockSection title="Program information" id="discount" rendered="{!oppty.discount__c>0 }">
            <apex:inputField value="{!oppty.field1}" />            
            <apex:inputField value="{!oppty.field2}"/>            
</apex:pageBlockSection>

or if you want to do on one column 
<apex:outputPanel rendered="{!con.discount>0}">
        <apex:column value="{!con.LastName}" />
    </apex:outputPanel>

I hope you find the above solution helpful. If it does mark as best answer to help others too.
Thanks,
Ramesh D
 

All Answers

Ramesh DRamesh D
You can use rendered={!fieldvalue="value"} to acheive this
<apex:pageBlockSection title="Program information" id="discount" rendered="{!oppty.discount__c>0 }">
            <apex:inputField value="{!oppty.field1}" />            
            <apex:inputField value="{!oppty.field2}"/>            
</apex:pageBlockSection>

or if you want to do on one column 
<apex:outputPanel rendered="{!con.discount>0}">
        <apex:column value="{!con.LastName}" />
    </apex:outputPanel>

I hope you find the above solution helpful. If it does mark as best answer to help others too.
Thanks,
Ramesh D
 
This was selected as the best answer
Sid LightningSid Lightning
So , it is done via visualforce page and not lightning component?
Sid LightningSid Lightning
Can you tell me the lightning code for it ?
Sid LightningSid Lightning
Hi,

Can you please help me in my other questions