+ Start a Discussion
RoyalRoyal 

OnChange event not working on picklist field ?

<apex:pageBlock id="PageBlock">      
                  
                  <apex:form >
<b>Type </b><apex:selectList id="selectlist" size="1">
                          <apex:selectOption itemValue="System Note" />
                          <apex:selectOption itemValue="Opportunty Note"/ >
                          <apex:selectOption itemValue="Case Note" />                          
                          <apex:selectOption itemValue="Case comment Note" />
                          <apex:actionSupport event="onchange" reRender="tableId" />                          
                          </apex:selectList>
 <apex:pageBlockTable value="{!DispalyValue}" var="var" id="tableId" >
                        <apex:column value="{!var.location}" headerValue="location" />
                        <apex:column value="{!var.name}" headerValue="name"/>
              </apex:form >
</apex:pageBlock>

if i select the picklist value pageblock table should be refresh, but not refereshing, what i did wrong here... any idea...

thanks in advance.
 
ManojjenaManojjena
Hi Royal,

Change the event to onselect and try .
Let us know still issue is there .

 
RoyalRoyal
no manoj it's not working...
ManojjenaManojjena
HI Royal,
CAn you explain your requirment if possible ,So that I will create a dummy code for you .
RoyalRoyal
just i have two sections in page block table in first section only picklist field is there in that field values is IND, US, UK...etc 

whenever user select the value in picklist second section should be refreshed based on selected value. 

is it clear Manoj..
ManojjenaManojjena
Hi Royal,
try with below code 
 
<apex:page controller="sample" id="pg">
    <apex:form >            
        <apex:selectList id="selList" value="{!countryCode}" required="false" size="1">
            <apex:selectOption itemvalue="None" itemLabel="--None--"/>
            <apex:selectOption itemvalue="INDIA" itemLabel="INDIA"/>
            <apex:selectOption itemvalue="USA" itemLabel="USA"/>
			<apex:selectOption itemvalue="UK" itemLabel="UK"/>
            <apex:actionSupport event="onchange" reRender="MsgDet" action="{!findMsg}"/>
        </apex:selectList>
        <br/>
        <apex:outputPanel id="MsgDet">            
                The value based on select list value: {!msg}            
        </apex:outputPanel>
    </apex:form>
</apex:page>

public class sample {
    public String countryCode {get; set;}
    public String msg {get; set;}

    public sample() {} 
    public void findMsg(){
        if(countryCode == 'INDIA'){
            msg = 'Welcome';
        }else if(countryCode == 'USA'){
            msg = 'Thank you';
        }else if(countryCode=='UK'){
		   msg='Sorry';
		}
	}            
}

Let me know if it helps !!
Thanks 
Manoj