Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 341199

Summary: HTML generated report evaluates JavaScript although visibility == false
Product: z_Archived Reporter: Sascha Becher <becher-sascha>
Component: BIRTAssignee: Birt-ReportEngine-inbox <Birt-ReportEngine-inbox>
Status: RESOLVED INVALID QA Contact: Xiaoying Gu <bluesoldier>
Severity: major    
Priority: P3 CC: bluesoldier, jouyang
Version: unspecified   
Target Milestone: 3.7.0   
Hardware: PC   
OS: Windows 7   
Whiteboard: obsolete

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.