Flare output overwriting custom body tag

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
Post Reply
nwilsonm
Propeller Head
Posts: 11
Joined: Thu Oct 15, 2009 6:46 am

Flare output overwriting custom body tag

Post by nwilsonm »

Hola, all,
I submitted this as a bug, but maybe you folks will have some insights in the meantime.
Am using Flare v5.
Here's the problem: To collect feedback on our API, we publish a custom version of WebHelp. Each topic contains a custom body tag that calls a JS onLoad function that effectively retrieves and dynamically inserts HTML for users to enter comments or code samples into each topic. There is a unique call for each topic. Returned data is stored in a database table configured for this purpose

The problem is that on compile Flare overwrites this custom tag & replaces it with plain old <body>. The custom tags are fine in the "source" topics, but gone in the output.

Does anyone know why it's doing this?

Is there some way to tell Flare to leave the <body> tag alone?

Just for fun I tried removing this code from Flare\Flare.app\Resources\Schemas\xhtml.xsd but no luck. :? Any and all help appreciated!
<xs:element name="body">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="block" />
<xs:element ref="form" />
<xs:group ref="misc" />
</xs:choice>
<xs:attribute name="onunload" type="xs:string" />
<xs:attribute name="onload" type="xs:string" />
<xs:attributeGroup ref="attrs" />
</xs:complexType>
</xs:element>
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Flare output overwriting custom body tag

Post by LTinker68 »

You said each topic has a unique call -- is the function name the same for each and it's just the JS code at the top of the topic that's different? If that's the case, maybe adding the onLoad function to the bodyProxy code on the masterpage will work.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
nwilsonm
Propeller Head
Posts: 11
Joined: Thu Oct 15, 2009 6:46 am

Re: Flare output overwriting custom body tag

Post by nwilsonm »

Hi.
For *each* of the 2000+ files there is a body tag like the following:
<body onLoad="javascript:getCommentsAndSampleCode('Components/Accessibility/getSettings.html', 'API_CommentsAndSampleCodeOnly', 'Method');">

The JS file checks to see if any divs in the HTML have an id of API_CommentsAndSampleCode, API_CommentsOnly, API_SampleCodeOnly.
- Based on the div found, the JS function makes an AJAX call to a CFM (coldfusion module) (which gives call to a CFC (coldfusion component)) to retrieve the required HTML and insert it dynamically.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Flare output overwriting custom body tag

Post by LTinker68 »

Ok, I figured out what you can do. If I understand your last post, the onLoad code itself is the same for each topic, correct? If that's the case, then you have two workarounds. One, delete your masterpage from the project. If you do that, the code in the topic is retained.

Option two, if you want to keep the masterpage, then create a paragraph class, call it something like hiddenCode, and set its display to none. Then open the masterpage in the Internal Text Editor and insert the following paragraph code at the top of the masterpage, after the masterpage's body tag but before the breadcrumbsProxy tag (or bodyProxy tag, if not using breadcrumbs):

Code: Select all

<p class="hiddenCode" onLoad="javascript:getCommentsAndSampleCode('Components/Accessibility/getSettings.html', 'API_CommentsAndSampleCodeOnly', 'Method');"> </p>
The paragraph is added to each topic at build time but since its display is none it doesn't show up in the output. Although some of the code might show up if you view the frame source code. I just did a quick and dirty test and I saw both the JS script and the JS onLoad passed through as CDATA text in the page code, but the JS script fired when the topic was loaded.

If I misunderstood your last post and you're saying the onLoad code is similar to what was shown but not the same for each topic, then option one is your only solution, at least in the short term. Long term, submit a feature request to http://www.madcapsoftware.com/bugs/submit.aspx asking for the ability to add function calls to a masterpage's body or bodyProxy tags and/or an option to have the properties of the masterpage's body tag not override the properties of the individual topic's body tag.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
nwilsonm
Propeller Head
Posts: 11
Joined: Thu Oct 15, 2009 6:46 am

Re: Flare output overwriting custom body tag

Post by nwilsonm »

Hi & many thanks!

Each topic has a unique function, so that
getSettings.html uses <body onLoad="javascript:getCommentsAndSampleCode('Components/Accessibility/getSettings.html', 'API_CommentsAndSampleCodeOnly', 'Method');">

saveSettings.html uses <body onLoad="javascript:getCommentsAndSampleCode('Components/Accessibility/saveSettings.html', 'API_CommentsAndSampleCodeOnly', 'Method');">

etc.

And you're right - our code works if the Master Page is disabled -- we've done that, but then I don't get breadcrumbs, which we want...is there a workaround there?
nwilsonm
Propeller Head
Posts: 11
Joined: Thu Oct 15, 2009 6:46 am

Re: Flare output overwriting custom body tag

Post by nwilsonm »

Hi, again.
Good thoughts all. I did indeed submit a bug asking if there was some way Flare could "keep its laws off my body tag"! :wink:. MC Support tried several workarounds, but no real fix for that.

In the meantime, we've written a routine that loops through the output & replaces the plain <body> tag with <body onLoad uniqueparam> tag for each file...so problem solved for the short term & submitted to MC dev for the long term...
Post Reply