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
AbAb 

Text area | limit number of columns and rows vertically

Hello,

Is it possible to limit the number of characters of a text area ?

I want to limit the number of columns too..like for example
123456
123456
13455
133555

Max only 6 characters are allowed on vertically
Best Answer chosen by Ab
AbAb
Hello,

The field is already filled by user. 
User-added image

I am just displaying it using VF like below
apex:outputText value="{!description}" />

The solution is not working

All Answers

shankar sudalaimanishankar sudalaimani
Hi Sandrine,
In Salesforce VisualForce or html?
Please,Explain in detail.
In HTML it is possible,if it is VFP,No option in that code but we can do it in only using java script:
http://www.forcetree.com/2013/02/character-count-limit-for-inputtextarea.html
http://salesforce.stackexchange.com/questions/32941/how-to-limit-apextextarea-length
http://stackoverflow.com/questions/3578678/how-can-i-block-further-input-in-textarea-using-maxlength

Please, Refer the above link.I think you will get some idea.
Thanks
Shankar S
Roshni RahulRoshni Rahul
Hi Sandrine,

Please refer the link below 
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_inputTextarea.htm

You can use the cols - The width of the field, as expressed by the number of characters that can display in a single row at a time.
rows - The height of the text area, as expressed by the number of rows that can display at a time.

eg ; 
<apex:inputTextarea rows="5" cols="5"/>

If you are using HTML, then refer the link http://www.mediacollege.com/internet/javascript/form/limit-characters.html

Hope these information helps. If my answer is informative, please mark it as best answer.

Regards
Roshni
AbAb

Hello,

Thank you for reply. 
The input is already entered by user. my problem is display in VF page.
I reverified , i display the text area like below

 

<apex:outputText value="{!description}" />

Thank for suggestion.
I want to limit the number of columns and rows displayed
Roshni RahulRoshni Rahul
Hi Sandrine,

There is one way you can limit the characters entered.
1st you have to make the input field that user enters as inputtextarea.
<apex:inputTextarea rows="5" cols="5"/>

Then change in VF page, instead of using outputText page, use use apex:outputField. Then it will display in the required format.
OR you can use 

<apex:outputText value="{!description}" style="white-space:pre;" /> 
It will preserve the spaces .
 
alos try <apex:outputText value="{!description}" escape="false" />  

Hope this helps.

If this is informative, please mark this as best answer.

Regards,
Roshni
AbAb
Hello,

The field is already filled by user. 
User-added image

I am just displaying it using VF like below
apex:outputText value="{!description}" />

The solution is not working
This was selected as the best answer