I am having trouble with data type Text Area(255), as there is no limit of character length.
I am having 1 field, Next_Step__c which is of data type Text Area.
I am showing it in VF page:
<apex:inputTextArea value="{!account.Next_Steps__c}" cols="60" rows="3" />
But, problem is there there is no max Length.
so is there any solution to achieve this : Max length I need 255 character.?
Attribution to: SFDC Geek
Possible Suggestion/Solution #1
Sorry I don't know if I understand the question but Text Area(255) is the largest number of characters that can be counted with an 8-bit number..
Are you trying to limit the length of what users are aloud to input? So only be 5 characters for instance? If this is the case you should be able to create a validation rule on Next_Step__c
such as LEN(Next_Steps__c) > 5 (whatever it is)
Edit
You can also try maxlength
**Keith beat me to it
This also may help you https://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_inputText.htm
Attribution to: EricSSH
Possible Suggestion/Solution #2
A maxlength
attribute for textarea
is a recent innovation in browsers and support is missing from IE9 and others (see e.g. HTML maxlength Attribute). So at present Visualforce doesn't offer a solution.
So if you want to enforce this on the client side e.g. to stop accepting characters after 255 have been typed in (or pasted in) then to work in a wide range of browsers you will need to use JavaScript. But AFAIK there isn't one "perfect" solution, but rather a variety of suggestions - see e.g. How can I block further input in textarea using maxlength.
To avoid JavaScript you can check the length at the server and output a message if the text is too long. Or you could just silently truncate to 255 characters at the server...
Attribution to: Keith C
Possible Suggestion/Solution #3
The simple solution would seem to be using and having that point to a Text Area field. That would get the length limited to whatever the limit is in Salesforce. I don't know how you would make the text box be a certain width, though - anyone know how to do that?
Attribution to: DavidSchach
Possible Suggestion/Solution #4
The <apex:inputtexarea>
is one of the Visualforce components that support the use of HTML pass-through. If the issue is how to use the maxlength attribute, then pass the attribute through using html as a prefix like:
<apex:inputTextArea value="{!account.Next_Steps__c}" cols="60" rows="3" html-maxlength="10" />
I wrote about this in a blog post: http://forceforte.com/limit-character-count-for-apex-inputtextarea-in-visualforce-using-angularjs/
Attribution to: Janet
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/32941