If you are unable to create a new account, please email support@bspsoftware.com

 

Error when trying to - create horizntal Check Box Prompt using Java Script

Started by mantvman, 11 Mar 2018 03:04:11 PM

Previous topic - Next topic

mantvman

I get an Error when trying to create Radio Button Horizontal Display in Cognos 11.0.9

This is the error message I get:

_M0L._4H2@https://cognosnext.bi.ibmcloud.com/bi/pat/halcchl_block.js:1:61904
_TQJ.prototype._4W6@https://cognosnext.bi.ibmcloud.com/bi/pat/rsstartupblock_9.js:53:20582
_TQJ.prototype._5B2@https://cognosnext.bi.ibmcloud.com/bi/pat/rsstartupblock_9.js:53:12340
_TQJ.prototype._465@https://cognosnext.bi.ibmcloud.com/bi/pat/rsstartupblock_9.js:53:10582
_MFF.prototype._BO3@https://cognosnext.bi.ibmcloud.com/bi/pat/rsstartupblock_2.js:5:2745
_MFF.prototype._7K5@https://cognosnext.bi.ibmcloud.com/bi/pat/rsstartupblock_2.js:5:2595

Then I get this error message

HTML report output is not well formed. If your report uses "HTML Item" elements ensure that they result in well-formed HTML.

Reason:XML Parsing Error: not well-formed

URL:https://cognosnext.bi.ibmcloud.com/bi/pat/rsapp.htm

Line:266
Character:272
Source:
<table cellpadding="0" cellspacing="0" border="0" class="pg" roid="i6" specname="page" LID="Page1"><tr><td isViewerInfo="true"><span tabIndex="0" isViewerInfo="true" specname="pageNumber">1</span></td></tr><tr><td class="pb" roid="i10" specname="pageBody"><script type=""text/javascript"">
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

This is the report XML copy for reproduction :

<report xmlns="http://developer.cognos.com/schemas/report/14.2/"           useStyleVersion="11.4" expressionLocale="en-us">
            
            <drillBehavior/>
            <layouts>
               <layout>
                  <reportPages>
                     <page name="Page1">
                        <style>
                           <defaultStyles>
                              <defaultStyle refStyle="pg"/>
                           </defaultStyles>
                        </style>
                        <pageBody>
                           <style>
                              <defaultStyles>
                                 <defaultStyle refStyle="pb"/>
                              </defaultStyles>
                           </style>
                           <contents><HTMLItem>
         <dataSource>
            <staticValue>&lt;script type=&quot;&quot;text/javascript&quot;&quot;&gt;
function inlineRadios(child){
if((child.type == &quot;&quot;radio&quot;&quot;)||(child.type == &quot;&quot;checkbox&quot;&quot;))
{
child.parentNode.parentNode.style.display=&quot;&quot;inline&quot;&quot;;
child.parentNode.parentNode.style.whiteSpace=&quot;&quot;noWrap&quot;&quot;;
}
}
function promptDescendants (node)
{
for (var i = 0; i &lt; node.childNodes.length; i++)
{
var child = node.childNodes;
inlineRadios(child);
promptDescendants(child);
}
}
&lt;/script&gt; </staticValue>
         </dataSource>
      </HTMLItem><HTMLItem>
         <dataSource>
            <staticValue>&lt;div id=&quot;&quot;RadioPrompt1&quot;&quot;&gt; </staticValue>
         </dataSource>
      </HTMLItem><selectValue parameter="Parameter1" selectValueUI="radioGroup" name="RadioPrompt1"><selectOptions><selectOption useValue="1"><displayValue>1</displayValue></selectOption><selectOption useValue="2"><displayValue>2</displayValue></selectOption><selectOption useValue="3"><displayValue>3</displayValue></selectOption></selectOptions><style><CSS value="width:300px"/></style></selectValue><HTMLItem>
         <dataSource>
            <staticValue>&lt;/div&gt; &lt;script&gt;promptDescendants(document.getElementById(&apos;RadioPrompt1&apos;));&lt;/script&gt; </staticValue>
         </dataSource>
      </HTMLItem></contents>
                        </pageBody>
                     </page>
                  </reportPages>
               </layout>
            </layouts>
         <XMLAttributes><XMLAttribute output="no" name="RS_CreateExtendedDataItems" value="true"/></XMLAttributes></report>
         
         
**********************************************************
         
And this is where I copied the JavaScript from: 

1) Put an HTML object at the top with the following code:

<script type=""text/javascript"">
function inlineRadios(child){
if((child.type == ""radio"")||(child.type == ""checkbox""))
{
child.parentNode.parentNode.style.display=""inline"";
child.parentNode.parentNode.style.whiteSpace=""noWrap"";
}
}
function promptDescendants (node)
{
for (var i = 0; i < node.childNodes.length; i++)
{
var child = node.childNodes;
inlineRadios(child);
promptDescendants(child);
}
}
</script>

2) Put an HTML object in front of the prompt object with the code:

<div id=""RadioPrompt1"">

3) Put an HTML object following the prompt object with the code:

</div> <script>promptDescendants(document.getElementById('RadioPrompt1'));</script>

MFGF

Quote from: mantvman on 11 Mar 2018 03:04:11 PM
I get an Error when trying to create Radio Button Horizontal Display in Cognos 11.0.9

This is the error message I get:

_M0L._4H2@https://cognosnext.bi.ibmcloud.com/bi/pat/halcchl_block.js:1:61904
_TQJ.prototype._4W6@https://cognosnext.bi.ibmcloud.com/bi/pat/rsstartupblock_9.js:53:20582
_TQJ.prototype._5B2@https://cognosnext.bi.ibmcloud.com/bi/pat/rsstartupblock_9.js:53:12340
_TQJ.prototype._465@https://cognosnext.bi.ibmcloud.com/bi/pat/rsstartupblock_9.js:53:10582
_MFF.prototype._BO3@https://cognosnext.bi.ibmcloud.com/bi/pat/rsstartupblock_2.js:5:2745
_MFF.prototype._7K5@https://cognosnext.bi.ibmcloud.com/bi/pat/rsstartupblock_2.js:5:2595

Then I get this error message

HTML report output is not well formed. If your report uses "HTML Item" elements ensure that they result in well-formed HTML.

Reason:XML Parsing Error: not well-formed

URL:https://cognosnext.bi.ibmcloud.com/bi/pat/rsapp.htm

Line:266
Character:272
Source:
<table cellpadding="0" cellspacing="0" border="0" class="pg" roid="i6" specname="page" LID="Page1"><tr><td isViewerInfo="true"><span tabIndex="0" isViewerInfo="true" specname="pageNumber">1</span></td></tr><tr><td class="pb" roid="i10" specname="pageBody"><script type=""text/javascript"">
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

This is the report XML copy for reproduction :

<report xmlns="http://developer.cognos.com/schemas/report/14.2/"           useStyleVersion="11.4" expressionLocale="en-us">
            
            <drillBehavior/>
            <layouts>
               <layout>
                  <reportPages>
                     <page name="Page1">
                        <style>
                           <defaultStyles>
                              <defaultStyle refStyle="pg"/>
                           </defaultStyles>
                        </style>
                        <pageBody>
                           <style>
                              <defaultStyles>
                                 <defaultStyle refStyle="pb"/>
                              </defaultStyles>
                           </style>
                           <contents><HTMLItem>
         <dataSource>
            <staticValue>&lt;script type=&quot;&quot;text/javascript&quot;&quot;&gt;
function inlineRadios(child){
if((child.type == &quot;&quot;radio&quot;&quot;)||(child.type == &quot;&quot;checkbox&quot;&quot;))
{
child.parentNode.parentNode.style.display=&quot;&quot;inline&quot;&quot;;
child.parentNode.parentNode.style.whiteSpace=&quot;&quot;noWrap&quot;&quot;;
}
}
function promptDescendants (node)
{
for (var i = 0; i &lt; node.childNodes.length; i++)
{
var child = node.childNodes;
inlineRadios(child);
promptDescendants(child);
}
}
&lt;/script&gt; </staticValue>
         </dataSource>
      </HTMLItem><HTMLItem>
         <dataSource>
            <staticValue>&lt;div id=&quot;&quot;RadioPrompt1&quot;&quot;&gt; </staticValue>
         </dataSource>
      </HTMLItem><selectValue parameter="Parameter1" selectValueUI="radioGroup" name="RadioPrompt1"><selectOptions><selectOption useValue="1"><displayValue>1</displayValue></selectOption><selectOption useValue="2"><displayValue>2</displayValue></selectOption><selectOption useValue="3"><displayValue>3</displayValue></selectOption></selectOptions><style><CSS value="width:300px"/></style></selectValue><HTMLItem>
         <dataSource>
            <staticValue>&lt;/div&gt; &lt;script&gt;promptDescendants(document.getElementById(&apos;RadioPrompt1&apos;));&lt;/script&gt; </staticValue>
         </dataSource>
      </HTMLItem></contents>
                        </pageBody>
                     </page>
                  </reportPages>
               </layout>
            </layouts>
         <XMLAttributes><XMLAttribute output="no" name="RS_CreateExtendedDataItems" value="true"/></XMLAttributes></report>
         
         
**********************************************************
         
And this is where I copied the JavaScript from: 

1) Put an HTML object at the top with the following code:

<script type=""text/javascript"">
function inlineRadios(child){
if((child.type == ""radio"")||(child.type == ""checkbox""))
{
child.parentNode.parentNode.style.display=""inline"";
child.parentNode.parentNode.style.whiteSpace=""noWrap"";
}
}
function promptDescendants (node)
{
for (var i = 0; i < node.childNodes.length; i++)
{
var child = node.childNodes;
inlineRadios(child);
promptDescendants(child);
}
}
</script>

2) Put an HTML object in front of the prompt object with the code:

<div id=""RadioPrompt1"">

3) Put an HTML object following the prompt object with the code:

</div> <script>promptDescendants(document.getElementById('RadioPrompt1'));</script>

Hi,

It looks to me like you've copied a piece of JavaScript written for a Cognos 10 report and tried to embed it in a Cognos Analytics report? If you want to adopt this approach, you're going to need to set the "Run with full interactivity" property for the report to "No", so that the report viewer emulates the old static Cognos 10 viewer. If you want to use JavaScript in a report with Full Interactivity enabled, you need to have the code stored in a file the server can access, and you reference it in your report using a Custom Control object.

Cheers!

MF.
Meep!