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
ManjunathManjunath 

Making certain field required based on the pickiest selection in visualforce page

Hi,

 

I have a picklist  with values A,B,C and 3 fields F1,F2and F3. If I select A as option then F1 should be required and if B is selected F2 in Visualforce page.

 

Can any help me on this.Thanks in advance.

 

Regards,

 

Sonam_SFDCSonam_SFDC

Hi Manjunath,

 

The following link blog explains this in detail with code snippet - worth a read!

http://salesforce.stackexchange.com/questions/4499/how-to-make-field-required-via-javascript

 

Hope this helps!

Dhaval PanchalDhaval Panchal
Try this,

Suppose picklist field is pklist__c

<apex:inputField value="{!obj.F1__c}" required="{!if(pklist__c=='A',true,false)}"/>
<apex:inputField value="{!obj.F2__c}" required="{!if(pklist__c=='B',true,false)}"/>
<apex:inputField value="{!obj.F3__c}" required="{!if(pklist__c=='C',true,false)}"/>