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
ChubbyChubby 

render field only if other field is valued

Hi All,

I need to render a picklist field if other text field is valued. How to check if the field is valued or not? Can someone please help me this.

Thanks In Advance.
Best Answer chosen by Chubby
Om PrakashOm Prakash
HiChubby,
You need to use rendered attribute.
Suppose your text varibale is textFieldVar then please refer bellow code
<apex:selectList value="{!selectedUser}"  size="1" rendered="{!if(textFieldVar != null , true, false)}">
	  <apex:selectOptions value="{!activeUsers}">                                                   
	 </apex:selectOptions> 
</apex:selectList>

 

All Answers

Manj_SFDCManj_SFDC
Hi are you referring to the logic in the code may be VF or dependent picklist
ChubbyChubby
Hi Yes I am refering in VF page.
Om PrakashOm Prakash
HiChubby,
You need to use rendered attribute.
Suppose your text varibale is textFieldVar then please refer bellow code
<apex:selectList value="{!selectedUser}"  size="1" rendered="{!if(textFieldVar != null , true, false)}">
	  <apex:selectOptions value="{!activeUsers}">                                                   
	 </apex:selectOptions> 
</apex:selectList>

 
This was selected as the best answer
ChubbyChubby
Hi,

Thanks for your responses. It got resolved.