0

My requirement is when we select language from drop down that language related information should appear.I tried this way its not getting my requirement.. using this page recalling but url not changing....

apex code :

public class actionsup{
public string selected{get;set;}
public pagereference selectlist(){
system.debug('language'+selected);
pagereference pg = page.actionsup;
if(selected != ''){
pg.getParameters().put('lang', selected);
}
pg.setRedirect(true);
return pg;
}
}

vusualforce code::

<apex:page controller="pages" language="{!$CurrentPage.parameters.lang}" >
<apex:form id="form">
<div >
<apex:actionRegion >
Language:<apex:selectList id="subroleList" value="{!selected}" size="1" >
<apex:selectOption itemLabel="----------------" itemValue="none"></apex:selectOption>
<apex:selectOption itemLabel="nl" itemValue="nl" id="tem1"></apex:selectOption>
<apex:selectOption itemLabel="de" itemValue="de" id="tem2"></apex:selectOption>  
<apex:actionSupport event="onchange" reRender="accounts" action="{!selectlist}" />
</apex:selectList> 
</apex:actionRegion>
<br/>
<apex:outputpanel >
<apex:outputText value="{!$Label.sample}" id="accounts"/>
</apex:outputpanel>
</div>
</apex:form>
</apex:page>

1 Answer 1

0

You should remove the reRender attribute from the actionSupport. If this attribute is present - the page will not be reloaded, but only an area from the reRender attribute is re-rendered.

<apex:actionSupport event="onchange" action="{!selectlist}" />
1
  • @user123 It is because the page is reloaded. You can use "reRender" attribute together with some void action method without apex:actionRegion. Then the selected context will not gone. It another technique, you should give it a try :) Mar 14, 2016 at 9:30

You must log in to answer this question.