------------------------------------Controller------------------------------------- public class ShowSectionController { public Account acc{get;set;} public boolean flag{get;set;} public ShowSectionController() { acc = new Account(); flag = true;
My question is like this for example if i select piklist value x containg values x,y,z in a picklist field in one record in page block table then i want to hide x value in picklist field in next record in page block table using input field tag so that i can select y value in second record, y nad z will be visible to me and x must be hidden.
You need to query on existing records on controller side, describe picklist values & populate picklist values those records are not created in your_option variable.
You can use javascritpt to do this easily.
can see the below code .You will get idea.
------------------------------------Controller-------------------------------------
public class ShowSectionController
{
public Account acc{get;set;}
public boolean flag{get;set;}
public ShowSectionController()
{
acc = new Account();
flag = true;
}
public void hideSectionOnChange()
{
if(acc.married__c == 'Yes')
flag = false;
if(acc.married__c == 'No')
flag = true;
}
}
-----------------------------------------------------------------------------------------------
---------------------------------------VF page----------------------------------------------
<apex:page controller="ShowSectionController" tabStyle="Account">
<apex:form >
<Apex:actionFunction name="hideSection" action="{!hideSectionOnChange}" rerender="pg"/>
<apex:pageBlock id="pg">
<apex:pageBlockSection title="Select A">
<apex:inputField value="{!acc.Married__c}" onchange="hideSection('{!acc.Married__c}')"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Section B" >
<Apex:inputText label="Name" rendered="{!(!flag)}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
You need to query on existing records on controller side, describe picklist values & populate picklist values those records are not created in your_option variable.
If this answers your question mark Best Answer it as solution and then hit Like!