Difference between revisions of "HowTo:Create Application-Specific Help"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 63: Line 63:
Then add the following code to the Help button:
Then add the following code to the Help button:
:<syntaxhighlight lang="javascript" enclose="div">
:<syntaxhighlight lang="javascript" enclose="div">
  loc = "networking/pages/PAGE_NAME"; // For example: networking/pages/MoreInfo.jsp
onclick="go(\''+targetURL+'\')" // For example: networking/pages/MoreInfo.jsp
</syntaxhighlight>
</syntaxhighlight>
::{{TBD|On click code for the button.}}
where the target URL has the form, "networking/pages/PAGE_NAME.jsp", for a page hosted in the platform.

Revision as of 23:04, 12 August 2015

WorkInProgress.gif

Work In Progress:
This page is under development.

About Application-Specific Help

The information here in the support wiki is intended primarily for application builders, admins, and installers. But end-users need information that is specific to the application they are using--and that is where application-specific help comes in.

In this article, we assume that you know how to add a button to a form, and that you know how to create an interface tab that displays a single HTML page of information. (The important point is to make sure that your help pages have no headers, so that links work.) With those basics in hand, you can go on to create context-sensitive help pages for your application.

Learn more:

Working with Application-Specific Help

Here, we assume that you want to display different pages, depending on the user's current location--so you'll be wiring help buttons that appear on different forms so they display different pages in the help tab. (You may even use JavaScript to go to different help pages, under different conditions.)

Going to the Help Tab

To go to the Help and display the default page, use this code to get the tab ID and "click" on it:

<script type="text/javascript">
function findByAttributeValue(attribute, value)    {
  var All = document.getElementsByTagName('*');
  for (var i = 0; i < All.length; i++)       {
    if (All[i].getAttribute(attribute) == value) { return All[i]; }
  }
}

function goToHelpTab() {
   var helpTabLinks = findByAttributeValue("display_title","HELP"); // there should be only one
   helpTabLinks[1].click();
}
</script>

Loading a Specific Page Into the Help Tab

When the Help button is clicked, code is invoked to find the Help tab, and effectively, reach an arm out from behind the screen, grab the mouse, and click on that tab!

Here is the function that does that:

<script type="text/javascript">
function findByAttributeValue(attribute, value)    {
  var All = document.getElementsByTagName('*');
  for (var i = 0; i < All.length; i++)       {
    if (All[i].getAttribute(attribute) == value) { return All[i]; }
  }
}

function go(loc) {
   var helpTabLinks = findByAttributeValue("display_title","HELP");
   helpTabs[1].src = loc;   


   // The iFrame that displays the content is created after the link is clicked.
   // The value we need to find it is stored in the link's "id" attribute.
   // Look for the iFrame until it is created. (Give up after 1,000 tries.)
   var iFrameID = "" + helpTabLinks[1].id;
alert("Looking for: "+iFrameID);

   var iFrame = document.getElementByID(iFrameID);
   iFrame.src = loc;
}
</script>

Then add the following code to the Help button:

onclick="go(\''+targetURL+'\')"  // For example: networking/pages/MoreInfo.jsp

where the target URL has the form, "networking/pages/PAGE_NAME.jsp", for a page hosted in the platform.