• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Sending an E-mail message from a Webhelp topic using JavaScript

New Here ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

I'm using a JavaScript published in STC's Intercom magazine ( http://www.stc.org/intercom/PDFs/2006/20067-8_14-17.pdf) for sending an e-mail message from a help topic to obtain feedback from users. I've followed the instructions for doing this, including adding the JavaScript file as a baggage file to the project, a script reference, and adding a link to call the script from the topic, but it doesn't work. When I test the link on the topic, I get an "Error on page" message. When I click the View this item icon in Robohelp, I get an Internet Explorer script error:

An error has occurred in the script on this page
Line: 5
Char: 15
Error: Invalid character
Code: 0

I have not written or debugged JavaScript before, just more or less cut and pasted existing scripts and changed variables, so I'm at a loss. Any idea what the problem is?

Code appears below. Many thanks!

Brett

Here's the script:

<!--
function sendFeedback()
{
var mailtoS = “mailto:<brett.peruzzi@pfpc.com>” +
“&Subject=Documentation feedback:
<test help file>” +
“&Body=” + “Topic title:” + document
.title +
“%0ABrowser:” + clientInformation
.appName +
“%0AVersion:” + clientInformation
.appVersion +
“%0A%0AComments:”;
window.open( mailtoS );
}
//-->

Here's the script reference:

<script type="text/javascript"
language=javascript1.2
src="feedback.js"></script>

And here's the link:

<p CLASS=BodyText
style="font-size: 9pt;
font-weight: normal;
font-style: normal;"><a href="javascript:sendFeedback()">Provide
feedback on this help topic</a></p>





Views

673

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

Hi Brett

I guess the link you provided only works if you are a dues paying STC member?

Just at first glance here, I'm wondering if your line breaks are occurring at odd places. Sometimes this is more than enough to cause that nifty crunching sound as our scripts break.

Hopefully others will offer up more, different or better insights here.

Cheers... Rick

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

You could try this one.

Here's what's in my feedback_script.js file:

var mailSubject = Subject Line Text';
var mailBody = 'I have comments on this page: ' + location.href;
var mailDisplay = '<img title= "Send us your comments." src="../../letter.gif" border=0>';
document.write(
'<a href="mailto:doc_address@domain'
+ '?subject=' + escape(mailSubject)
+ '&body=' + escape(mailBody)
+ '">' + mailDisplay + '</a>');

letter.gif is at the root, two steps above, as is feedback_script.js. The call in each file is:

<p span
style="font-weight: normal; x-condition: Online;"><script src="../../feedback_script.js"
language=javascript
type="text/javascript"></script> <!--kadov_tag{{<spaces>}}--> <span
class=Comments><!--kadov_tag{{</spaces>}}-->Comments</span></p>


Good luck,
Leon


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

Brett, Rick, & Leon -

I ran the script through its paces, and found that the STC newsletter typographers have done the misdeed. It doesn't show up here, but their sendFeedback() function is infested with typographic quotes, rather than ascii-compliant quotemarks.

If you can't see them with your current editor, look at the file in Wordpad, and replace them there. A little typographic quote disinfectant, and it should work just fine.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 15, 2006 Aug 15, 2006

Copy link to clipboard

Copied

Thanks for all of your help.

I replaced the incorrect quotation marks (they didn't show up that way in Notepad, but did in Wordpad), but the script still didn't run. I changed the line breaks and it ran, but with somewhat incorrect results.

All of the data appears in the To: field of the e-mail client (Notes 6.5 in my case), rather than also in the Subject and body fields.

Sample results:

<brett.peruzzi@pfpc.com>&Subject=Documentation feedback:<test help file>&Body=Topic title:Admin Site Log ReportBrowser:Microsoft Internet ExplorerVersion:4.0 (compatible; MSIE 6.0; Windows NT 5.0; PNCStd; InfoPath.1)Comments:

Of course, a message that gets sent like this gets returned as undeliverable. Any idea how I can get the subject and body areas of the e-mail to populate correctly?

Here's the revised script:

<!--
function sendFeedback()
{
var mailtoS="mailto:<brett.peruzzi@pfpc.com>" +
"&Subject=Documentation feedback:<test help file>" +
"&Body=" + "Topic title:" + document.title +
"%0ABrowser:" + clientInformation.appName +
"%0AVersion:" + clientInformation.appVersion +
"%0A%0AComments:";
window.open( mailtoS );
}
//-->

Thanks again,

Brett

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 15, 2006 Aug 15, 2006

Copy link to clipboard

Copied

LATEST
Actually, just fixed it!

Showed the script to one of my developer friends here, and he recommended putting a ? after the mailto address, and that fixed it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp