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
Sourav PSourav P 

Field depedencies option in Standard page

Dear All, if you can help me out here,
I have the below custom object, with all custome fields.

Now if the first field " Are you driving" has two vaalues Yes & No. If its YES, i want the below fields to be hided( no need to fill), If its only NO , then the user need to fill the below fields. Is it a way possible by any point and click option ? or entire page need to get created in VF ?
As i am not that perfect in apex coding, alternate method wld be more useful. If Apex is the only way, if some one cann give me some coding started suggest. Thanks
User-added image
 
Best Answer chosen by Sourav P
RbnRbn
Hi Sourav,

Please find the below code snippet.
i am just dispaying/hiding 2 fields.You can append all your required fields in the same way.
 
<apex:page standardController="Account" >
<apex:form >
<apex:outputPanel id="tab">
<apex:pageBlock title="Display Fields">
<apex:pageBlockSection title="Information" columns="1">
<apex:inputField value="{!Account.Are_you_Driving__c}">
<apex:actionSupport event="onchange" rerender="tab" />
</apex:inputField>
<apex:inputField value="{!Account.Driver_Name__c}" rendered="{!IF( Account.Are_you_Driving__c == 'No', true, false )}"/>
<apex:inputField value="{!Account.Age__c}" rendered="{!IF( Account.Are_you_Driving__c == 'No', true, false )}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
</apex:form>
</apex:page>
Let me know if you require further help on this!!
Mark it as solution if it solves your question.!!!!

Rgrds,
Rabi

All Answers

AshlekhAshlekh

Hi,

The thing which you want to acheiv is only possible through VFP. And per layout the below fields are required field on layout. So you need to care while creating VFP functionality.
 

-Thanks
Ashlekh Gera

Sourav PSourav P
Thanks Ashlekh, Do you have any doc link how to create this type VF page, i am a newbie in creating VF thats of an entire object fields.
RbnRbn
Hi Sourav,

Please find the below code snippet.
i am just dispaying/hiding 2 fields.You can append all your required fields in the same way.
 
<apex:page standardController="Account" >
<apex:form >
<apex:outputPanel id="tab">
<apex:pageBlock title="Display Fields">
<apex:pageBlockSection title="Information" columns="1">
<apex:inputField value="{!Account.Are_you_Driving__c}">
<apex:actionSupport event="onchange" rerender="tab" />
</apex:inputField>
<apex:inputField value="{!Account.Driver_Name__c}" rendered="{!IF( Account.Are_you_Driving__c == 'No', true, false )}"/>
<apex:inputField value="{!Account.Age__c}" rendered="{!IF( Account.Are_you_Driving__c == 'No', true, false )}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
</apex:form>
</apex:page>
Let me know if you require further help on this!!
Mark it as solution if it solves your question.!!!!

Rgrds,
Rabi
This was selected as the best answer
Sourav PSourav P
Thanks Ravi, worked .