• Kenneth Daniels 9
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I am trying to use javascript to display an alert is certain conmditions are met. I am not a javascript programmer.

My code is as follows:

if ("{!Contact.Banned_Warning_Explanation__c}" == "")
{
 alert ("{!Contact.FirstName}" + " " + "{!Contact.LastName}" + " is free to use the center.");
}
else
{
alert ("{!JSENCODE(Contact.Banned_Warning_Explanation__c)}");
};

The first part of this works, if the field is empty the correct message displays. The second part of the clause returns an unterminated literal error. I understand this relates to unhandled line termination characters for example. If the second alert is the only code used it works properly and will display the field even if it is multiline. When I included in the If..else structure is when this error started.