0

I've a formula field like this :

Address__c & BR() + City__c & ',' & text(State__c) & BR() & Zip_Code__c

This is showing complete mailing address, separated by line breaks using BR() function

This works fine in reports But when it try to display this field in VF page using OutputText tag, This come up like this :

enter image description here

what can I do avoid this ?

1

By default, the apex:outputText component escapes special HTML characters to prevent injection attacks. In this case, it's catching the HTML line breaks generated by the BR() function. You can override this behaviour by setting the attribute escape="false" on the tag. Alternately, if you're just displaying a formula field, you might want to use the apex:outputField component instead, although this will also generate a field label.

Details on the two components can be found here:

apex:outputText

apex:outputField

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.