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
varma uvarma u 

using action function

i have a picklist field country with different values.now if i select 'india' then only page should be refreshed and a pageblock section should be displayed,if i select any value other than 'india' then that pageblock section should be hidden.i need to achieve this using action function only.can u plz help me?
Ramu_SFDCRamu_SFDC
Below post should solves your requirement

https://success.salesforce.com/answers?id=90630000000hTaaAAE

Please mark this as the best answer if it did solved your requirement.
AshlekhAshlekh
Hi,

The code is here

public class ShowSectionController
{
   
    public boolean flag{get;set;}
	public String countries{set;get;}
    public ShowSectionController()
    {
		countries ='';
		flag = true;
       
    }
	
	public List<selectOption> getItems(){
		List<selectOption> x = new List<selectOption>();
		x.add(new SelectOption('','---None---'));
		x.add(new SelectOption('India','India'));
		x.add(new SelectOption('USA','USA'));
		x.add(new SelectOption('England','England'));
	    return x;
	}
    public void hideSectionOnChange()
    {
        if(countries == 'Inida')
            flag = false;
    }
}
<apex:page controller="ShowSectionController" tabStyle="Account">
  <apex:form >
  
	<apex:outPutPanel id ="OutPutPanelID">
      <apex:pageBlock id="pg">
          <apex:pageBlockSection title="Select A">
				<apex:selectList value="{!countries}" multiselect="false" size="1">
						<apex:selectOptions value="{!items}"/>
				 <apex:actionSupport event="onchange" action="{!hideSectionOnChange}" rerender="OutPutPanelID"/>	
				</apex:selectList><p/>
		  </apex:pageBlockSection>
		  
          <apex:pageBlockSection title="Section B" rendered="{!(!flag)}">
            
          </apex:pageBlockSection>
       
      </apex:pageBlock>
	  </apex:outPutPanel>
  </apex:form>
</apex:page>