Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341199 - HTML generated report evaluates JavaScript although visibility == false
Summary: HTML generated report evaluates JavaScript although visibility == false
Status: RESOLVED INVALID
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 3.7.0   Edit
Assignee: Birt-ReportEngine-inbox@eclipse.org CLA
QA Contact: Xiaoying Gu CLA
URL:
Whiteboard: obsolete
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-29 05:12 EDT by Sascha Becher CLA
Modified: 2011-05-26 13:33 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sascha Becher CLA 2011-03-29 05:12:08 EDT
When generating the report as HTML (with servlet=frameset), the JavaScript of a text field gets evaluated besides the fact, that the visibility should prevent showing the text field. This results in a NPE when calling model.getEvaluator().getGender(), which the Visibility condition should prevent. It works as expected with DOC and PDF. 
It seems that the JavaScript gets otherwise processed than with servlet=run.


<text id="833">
  <property name="fontFamily">"Arial"</property>
  <property name="fontSize">7pt</property>
  <property name="paddingBottom">10pt</property>
    <list-property name="visibility">
      <structure>
        <property name="format">all</property>
        <expression name="valueExpr" type="javascript">model.getEvaluator()==null</expression>
      </structure>
    </list-property>
    <property name="contentType">html</property>
    <text-property name="content"><![CDATA[Bearbeitet von 
<VALUE-OF>model.getGenderTitle(model.getEvaluator().getGender())</VALUE-OF>
&amp;nbsp;<VALUE-OF>model.getEvaluator().getLastName()</VALUE-OF>
&amp;nbsp;<VALUE-OF>
<BR />]]></text-property>
</text>
Comment 1 Jun Ouyang CLA 2011-03-29 23:04:33 EDT
We have to evaluate the value script even when visibility is false because firstly visibility is processed after value is evaluated; secondly, the visibility may be false for some formats and true for others.

So please don't assume the value script won't be executed if item is hidden.
Comment 2 Sascha Becher CLA 2011-03-30 08:04:41 EDT
 Thank you for the quick answer.

> We have to evaluate the value script even when visibility is false because
> firstly visibility is processed after value is evaluated; 

 Why is that? I mean this makes the visibility check useless. I still have to 
 evaluate inside the text element, whether the property is null and exclude
 it from output. Maybe there are elements in the documents tree for which this
 behaviour might make sense, but for elements of type TEXT???

> secondly, the visibility may be false for some formats and true for others.

 The JavaScript code (for example: model.isElementXyVisible() ) can have 
 different results on different output formats? 

> So please don't assume the value script won't be executed if item is hidden.

 This should be documented in detail. In PDF format, the JavaScript doesn't
 get executed when visibility == false. So I have no reason to expect a different
 behaviour for HTML output.