+ Start a Discussion
Ranjith PunneliRanjith Punneli 

Visualforce page in home page custom component for links

Hello,

 

I have a vsualforce page that displays a button based on user language. This is associated to home page custom component with type as Links in customer portal home page. However, this button is always displayed regardless of language. It is working finw when I execute as apex/vfpage.

 

<apex:page controller="controller" sidebar="false" showHeader="false" cache="false" standardStylesheets="false">
<apex:form>
<apex:pageBlock>
<apex:outputPanel rendered="{!showButton}">
<apex:commandButton action="{!action}" value="Button" />
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>

 

public class controller{

public String userLanguage;
public Boolean showButton{get;set;}
public controller() {
currentUser = [SELECT id, languagelocalekey, contactId FROM User WHERE id = :UserInfo.getUserId()];
userLanguage = currentUser.languagelocalekey;
if(userLanguage == 'en_US'){
showButton = True;
}
else {
showButton = False;
}
}
public pageReference action(){
return null;
}
}

 

Thanks,

R