Peg,
It has been a while since I've use JScript, one of the challenges I recall in adding JScript Pre-Execution is that it doesn't play nice with VBScript pre-execution in the same foundation page. You'll have to declare
<%@ language="javascript"%> inside a pre-ex block at the top of the foundation and then use only JScript on the page including all things included by containers. I seem to recall that vbscript doesn't have the nice functions for date manipulation.
This all assumes you have ASP Pre-execution setup and working elsewhere in the project. Another old trick is to leave out the Pre-execute and have <!--RDExecute=asp--> in the page if its just an error in your code. You'll need the <%@ language="javascript"%> outside the any pre-ex blocks to get this code to run in RDExecute.
Best,
Tim
On Wednesday, August 22, 2012 1:42:01 PM UTC-4, PegG wrote:
I've searched the threads on this group, and simply haven't found an answer for my problem.
I've got a section of Javascript that takes a date element and changes the output format. It works perfectly on my RSS feed, but I continually get the dreaded 500 error in my article list content class.
Here is the story so far.. ;)
My users want to have a list of news articles that are basically links to various media sources. And they want this list to be available as an RSS feed. I've got that all working wonderfully, BUT there is a catch - isn't there always?
On the list of articles, they want the date formatted as "Aug 22" only. So I added to my Jscript code that converts the date/time element into valid UTC format by adding a switch on the month. The results display correctly in my RSS feed (I added it temporarily into the description content).
BUT no matter what I do, or where I place the PreExecute tags in my list cc, it errors out.
I know that an easy fix would be to require the users have two date elements to complete, but that is not an option. My users will complain till they are blue in the face.
Any suggestions as to where I should place the tags?
Thanks - peg
code below
-----------------------------------------------------------------------------------------
<!IoRangeRedDotMode><!IoRedDotOpenPage><span
class="reddotText">[<!IoRangeNoEditMode>open<!/IoRangeNoEditMode><!IoRangeRedDotEditOnly>save<!/IoRangeRedDotEditOnly> <!IoRangeNoEditMode>NewsLink Items<!/IoRangeNoEditMode>]</span><!/IoRangeRedDotMode>
<table cellSpacing=3
cellPadding=3 border=0 sizcache="47" sizset="80">
<tbody
sizcache="47" sizset="80">
<!IoRangeRedDotEditOnly><!IoRedDot_lst_NewsLinks><span
class="reddotText">[add/re-order/remove links]</span><br /><br
/> <!/IoRangeRedDotEditOnly>
<!IoRangeList>
<tr
vAlign=top align=left sizcache="47" sizset="81">
<td
vAlign=top width="10%">
<%
var newPressDate= new Date("<%std_DateTime%>");
switch(newPressDate.getMonth())
{
case 0:
monthdayOnly = "Jan " +
newPressDate.getDate();
break;
case 1:
monthdayOnly = "Feb " +
newPressDate.getDate();
break;
case 2:
monthdayOnly = "Mar " +
newPressDate.getDate();
break;
case 3:
monthdayOnly = "Apr " +
newPressDate.getDate();
break;
case 4:
monthdayOnly = "May " +
newPressDate.getDate();
break;
case 5:
monthdayOnly = "Jun " +
newPressDate.getDate();
break;
case 6:
monthdayOnly = "Jul " +
newPressDate.getDate();
break;
case 7:
monthdayOnly = "Aug " +
newPressDate.getDate();
break;
case 8:
monthdayOnly = "Sep " +
newPressDate.getDate();
break;
case 9:
monthdayOnly = "Oct " +
newPressDate.getDate();
break;
case
10:
monthdayOnly = "Nov " +
newPressDate.getDate();
break;
case
11:
monthdayOnly = "Dec " +
newPressDate.getDate();
break;
}
%>
<%=monthdayOnly%>
</td>
<td sizcache="47"
sizset="81">
<!IoRangeRedDotEditOnly><a href="<%lst_NewsLinks%>"><%hdl_ArticleTitle%></a> <span
class="reddotText">[for editing only]</span><br><!/IoRangeRedDotEditOnly>
<a
href="<%std_ArticleURL%>"><%std_ArticleTitle%></a><br>
<em><%std_MediaSource%></em><br>
<%txt_ArticleBlurb%>
<br
/><%txt_RelatedBlurb%>
</td>
</tr>
<!/IoRangeList>
</tbody>
</table>
<div class="clear25"></div>