You need to sign in to do that
Don't have an account?
MikeGinou
Problems using Custom Label as Attribute default value
I am trying to use a Custom Label as the default value for a string attribute in an Apex Component, however it doesn't appear to work.
Given the a custom label Default_Title with a value of "Default Title" and the following component:
<apex:component> <apex:attribute name="title" type="String" default="{!$Label.Default_Title}" description="Title" /> <apex:outputText value="{!title}" /> </apex:component>
What you would expect to see is "Default Title", instead what I'm getting instead is "#{$Label.Default_Title}".
Any advice?
Thanks!
Hi MikeGinou,
I tried to execute that code and I have the same problem.
What you need to do is to assign that label value throw the controller and then put in apex:attribute default that variable
I opted to remove the default value from the attribute and use {!BLANKVALUE(title,$Label.Default_Title)} where I was referencing {!title} previously.
I haven't tried it, but I could probably also use the apex:variable tag, if I needed to reference the title attribute multiple times: