You need to sign in to do that
Don't have an account?
On Click Javascript and carriage return error.
Hello,
I have a button with on click javascript attached to it. I am using this to make sure a custom comment field is filled out before sending to my custom apex page. The problem is if the user hits the enter key in the comments then I get an on click javascript error stating there is a unterminated string. Anyone else have this problem? Any ideas on how to get around this?
Here is the code:
var comments;
comments="{!Case.Convert_To_Lead_Comments__c}";
if(comments==null || comments=="")
{
alert("Please enter comments into Convert To Lead Comments section!");
}
else
{
window.location= "/apex/ConvertCaseToLeadButton?id={!Case.Id}";
}