Skip to main content
romana_lungbarrow
May 25, 2023 1:28 PM UTC
Solved

JavaScript syntax error

Hi,

I'm trying to write some JavaScript for a block in my email that pulls in fields from a data table (where possible). I am struggling with a syntax error somewhere and its really hard for me to debug as it is crashing Adobe Campaign quite severely. Can anyone see what's going wrong?

 

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
isahore
isahoreAccepted solution
Community Advisor
May 25, 2023 3:06 PM UTC

Hi @romana_lungbarrow,

This below highlighted is the extra bit here:

else { %>Departing <% }%><%= formatDate(targetData.tr_date, "%2D/%2M/%4Y") %> <% } %><% }%>

 

Thanks,

Ishan

3 replies

isahore
Community Advisor
isahoreCommunity AdvisorAccepted solution
Community Advisor
May 25, 2023 3:06 PM UTC

Hi @romana_lungbarrow,

This below highlighted is the extra bit here:

else { %>Departing <% }%><%= formatDate(targetData.tr_date, "%2D/%2M/%4Y") %> <% } %><% }%>

 

Thanks,

Ishan

Translate
david--garcia
Level 10
May 26, 2023 12:40 AM UTC

Give the following a go.

 

<% if (targetData.tr_nights == "any duration") { %>any duration <% } else if (targetData.tr_nights > 0) { %><%= targetData.tr_nights %> nights <% } else {//nothing} %> <% if (targetData.tr_ship) { %>aboard the <%= targetData.tr_ship %> <% } else { %>cruising<% }%> <% if (targetData.tr_passengers) { %>for <%= targetData.tr_passengers %> passengers<% }%>. <% if (targetData.tr_date == "any dates") { %>Departing any dates <% } else { %>Departing <%= formatDate(targetData.tr_date, "%2D/%2M/%4Y")%><%}%> <% if (targetData.tr_price > 0) { %> from £<%= numberWithCommas(parseFloat(targetData.tr_price).toFixed(2)) %>. <span style="mso-line-height: exactly; line-height:10px;"><br /><br /></span> <% }%> <% if (targetData.tr_reference) { %> Reference: <font style="font-weight: bold;"><%= targetData.tr_reference %></font><br> <% } %> <% if (targetData.tr_code) { %> Holiday code: <font style="font-weight: bold;"><%= targetData.tr_code %></font> <% } %>
Translate
https://www.linkedin.com/in/david-garcia-uk/ | https://martech.network
Sukrity_Wadhwa
Level 4
Jun 7, 2023 9:40 AM UTC

Hi @romana_lungbarrow,

Were you able to resolve this query with the help of the given solutions or do you still need more help here? Do let us know. In case the given solutions were helpful, then kindly choose the one that helped you the most as the 'Correct Reply'.
Thanks!

Translate
Sukrity Wadhwa