Expand my Community achievements bar.

Join us for the Adobe Campaign Community Q&A Coffee Break on 30th September at 8 am PT with Campaign experts Arthur Lacroix and Sandra Hausmann.
SOLVED

JavaScript syntax error

Avatar

Level 1

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?

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @romana_lungbarrow,

This below highlighted is the extra bit here:

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

 

Thanks,

Ishan

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @romana_lungbarrow,

This below highlighted is the extra bit here:

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

 

Thanks,

Ishan

Avatar

Community Advisor

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>
	<% } %>

Avatar

Administrator

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!



Sukrity Wadhwa