You need to sign in to do that
Don't have an account?
Jay reddy
javascript error not allow line breaks in the text input field
Hello,
I'm getting javascript error when entering a text with line break in a field, which is mentioned in the javascript code. Is there a way to skip that error from a line break. I used JSENCODE but it's working for special characters only and not for line breaks. Below is the way I have defined the field in Javascript.
GR
I'm getting javascript error when entering a text with line break in a field, which is mentioned in the javascript code. Is there a way to skip that error from a line break. I used JSENCODE but it's working for special characters only and not for line breaks. Below is the way I have defined the field in Javascript.
var field = '{!JSENCODE(Opportunity.Closing_instructions__c)}'; field = field.replace(/(/\r?\n|\r/),"");Thanks,
GR
Please try this
Here is a screenshot -
I then used JSENCODE and I was able to solve the issue. Here is the code -
Here is a screenshot -
In my example, I have used Text Area type of field. Are you also using Text Area type? Please let me know.
Hi .. Thanks for the reply. As I mentioned in my question, I have used the JSENCODE in my code. But it's still throwing me an error whenever I give line breaks in the Text field.
Secondly, I have my code in the custom button. Furthermore, my field is Long Text Area field.
Thanks,
GR