1

I have one field with long text area datatype with limit 1000. During the input, I am using JEasyCounter to validate 1000 character. The user insert 1000 character including new line (Of course creating new line is not counted as character) and it prompt this error.

Upsert failed. First exception on row 0 with id aKMn0000000000asGAA; first error: STRING_TOO_LONG

I notice it read somewhere in the error description. However when I remove new line, just type 1000 character then it will be saved successfully.

How should I handle this?

2

From the documentation of the Text Area (long):

Note that every time you press Enter within a long text area field, a linebreak and a return character are added to the text. These two characters count toward the 131,072 character limit.

So you should somehow cut out these characters: \rand \n

  • can it be done in javascript side?i m not sure jeasycounter able to catch this.i need to research more. – unidha Mar 23 '15 at 13:33
  • @unidha Of course it could be done with javascript. BUT you need to implement a double check: JS and Apex. – Sergej Utko Mar 23 '15 at 13:36

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.