function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Text to be displayed on the page

Hi All.


I have the following requirement -


I want a text to be displayed on the page that should be just a label, not to be associated with any field. It is a normal page and not a Visualforce page.

My text is about 200 characters (the character limit for field label is 50 chars and that for section label is 80 chars).


Can anyone suggest me the solution for this?


Any help will be GREAT :)



Keep it simple - consider using a text field with an appropriate label (note, guidance, what ever the text represents.  Put the text in the field and make it read only.

Thanks for reply.


I would have surely done that.

But, I want users to know what to enter in the field. So, I want some text to be displayed for them listing the information they should fill in to the field.




Ok - try using the field level help - not sure it will give 200 characters though you may be able to make it work.?
You can enter up to 255 characters in field level help.

Thanks for ur reply..


I have added the help text, but I am planning not to take risk i.e. what if user does not hover over my "?" to view the help text.


Alternatively, can you tell me if at all this can be done with the help of Visualforce?




The only ways I know of I have described.  If the help text is too risky and users just can not be trained to actually use it, you could consider using the first method ( a field) to describe the other field and place them together onthe layout? 


Alos depending on what you want the field to contain - you might look at validation rules to control what is entered if that makes sense for your needs.


Could also create a simple visualforce page...



<apex:page sidebar="false" showHeader="false"> Insert text here, with this for line break<br/>

  This would allow you to add multiple lines without creating a long Text Area field



 Then just add the visual force page to the page layout (remember, you will have to adjust the window size of the VF page to fit the text)



I want to add visualforce page to my Page layout for my Custom object.

Since it is a custom object, it does not show me any option of Visualforce Pages in my page layout.


For standard objects, we can use -


<apex:page standardController="objectname">


Any idea, what should be done in case of custom objects?




The reason you don't have the Visualforce option in the layout design page is because you haven't authored any VF pages with a standard controller as that object.  Try just authoring a page:



<apex:page standardController="customObject__c"> ...</apex:page>


 That should give you the option to add VF pages to the layout, then you can create a controller extension if necessary to get your desired functionality



Hey, thanks... That worked.


I have added the page to my page layout and have used -

<apex:outputLabel value="abc">

in my page.


But, it does not render anything on my page. Let me know if I am going wrong anywhere?




What is the end goal here?  Just text?  If so, use the following syntax...



<apex:page standardController="customObject__c">

Insert standard text here, use this for line breaks <br/>

This text will display on a different line<br/>

You can also insert field values like this: {!Name}



 You shouldn't need a fieldLabel if all you want to do is output text.




Message Edited by Execbiz on 08-03-2009 07:05 AM



I used the below code. However, I am looking forward to display this text even when a new Object is created by the user, i.e. while in Edit mode.


Currently, the text is only being shown up when I view any of the existing record for that object.


I am sure you can help me even for this one :)




Hmmm, that could get a little ugly.  Unless I'm overlooking something, the best way to do that would be to create a VF page that recreates the Edit page, including the section of text you want:



<apex:page standardController="customObject__c">


<apex:pageBlock title="Edit Box" mode="edit">


<apex:commandButton action="{!save}" value="Save"/>


<apex:pageBlockSection title="Edit Fields" columns="2">

Text to display showing instructions for user<br/>

Including line breaks, and {!fields}

<apex:inputField value="{!customObject__c.field1}"/>

<apex:inputField value="{!customObject__c.field2}"/>





 You can create multiple pageBlockSections for each section of fields if you'd like.  Then when you're done, go to Setup→Create→Objects→(your object)


Then click Override in the page layouts table under the Edit page layout, and select the VF page you've just created.  This should override the normal edit page with your custom edit page, which includes the text you want. 


Message Edited by Execbiz on 08-03-2009 09:00 AM

I'm trying to do something very similar - use either an S-control or Apex page

(I tried both) to display text on a Case record, (greater than 80 characters).


EIther method works fine on view of the case, but disappears when the user

clicks to edit the Case?  Help !