Minor Syntax Problem...

Exchange HTML report templates between users.
Post Reply
User avatar
gjones
Posts: 5
Joined: Fri Nov 18, 2005 7:11 pm
Location: Los Angeles, CA

Minor Syntax Problem...

Post by gjones »

Hopefully minor, that is...

I'm using a custom HTML report with the showinfo() function imbedded into a script line that makes sure the hostname displays in upper case and changes the button colors if it has been up less than 99% of the last day.

Problem is, the buttons don't display anything when clicked on in "Good" or "Good99" status. "Bad" and "Acknowledged work properly. It must be a syntax problem with the way I'm using the escape character, but after an hour I still haven't got it to work.

Test Items (Good):

Code: Select all

<SCRIPT type="text/javascript"> 
  var HN = "%CommentLine1%";
  HN = HN.toUpperCase();
  if (%PassedCnt%/%TotalTests%>0.99) document.write("<input type=button class=Good99 value= "+HN+" onclick=\"showinfo('Test name: \t%TestName% \nStatus: \t\t%Status% \nRecurrences: \t%Recurrences% \nReply: \t\t%Reply% \nUp Time: \t%AliveTime%')\">");
  else document.write("<input type=button class=Good00 value= "+HN+" onclick=\"showinfo('Test name: \t%TestName% \nStatus: \t\t%Status% \nRecurrences: \t%Recurrences% \nReply: \t\t%Reply% \nUp Time: \t%AliveTime%')\">");
--></script>
Produces the following HTML:

Code: Select all

<SCRIPT type="text/javascript"> 
  var HN = "LDAPC78";
  HN = HN.toUpperCase();
  if (132/132>0.99) document.write("<input type=button class=Good99 value= "+HN+" onclick=\"showinfo('Test name: \tLDAPC78 

Image Workstation \nStatus: \t\tHost is alive \nRecurrences: \t2330 \nReply: \t\t31 ms \nUp Time: \t22:00:39')\">");
  else document.write("<input type=button class=Good00 value= "+HN+" onclick=\"showinfo('Test name: \tLDAPC78 Image Workstation 

\nStatus: \t\tHost is alive \nRecurrences: \t2330 \nReply: \t\t31 ms \nUp Time: \t22:00:39')\">");
--></script>
I would appreciate the help as we use the popup info to identify the time of the failure so we know which processes have to be rerun.

Thanks -
Yoorix
Posts: 177
Joined: Wed Dec 14, 2005 8:28 am

Post by Yoorix »

I think you should to protect slash in special characters like "\n","\t". Try to substitute "\n" with "\\n", "\t" with "\\t" and so on.
I have written sample code and ot works! ;-)

Regards,
Yoorix
User avatar
gjones
Posts: 5
Joined: Fri Nov 18, 2005 7:11 pm
Location: Los Angeles, CA

Yes!

Post by gjones »

Thank you, kind sir.

You were 100% correct. Our buttons all work perfectly now.
Post Reply