I am creating a PDF with an editable check box. I am using jasper library 6.20.0 and Java 8.
When I click the checkbox, I want the adjacent date field to be automatically populated with that day's date. I could make the checkbox working with the below code:
When the above checkbox is checked, I want the below date to be populated, and otherwise not.
<textField pattern="MM-dd-yyyy" > <reportElement x="42" y="0" width="84" height="21"> <propertyExpression name="net.sf.jasperreports.export.pdf.field.name"><![CDATA["Date-" + String.valueOf(java.lang.Math.random())]]></propertyExpression> <printWhenExpression><![CDATA[$F{test}.equals("Y")]]></printWhenExpression> <!-- THIS LINE DOES NO WORK. IT SHOULD BE TRUE WHEN THE CHECKBOX IS CHECKED. --> </reportElement> <textElement verticalAlignment="Middle"> <font size="8"/> </textElement> <textFieldExpression ><![CDATA[(java.util.Calendar.getInstance().getTime())]]></textFieldExpression> </textField>
Retrieving values of editable fields
in Products
Posted
Hi Friends
I am creating a PDF with an editable check box. I am using jasper library 6.20.0 and Java 8.
When I click the checkbox, I want the adjacent date field to be automatically populated with that day's date. I could make the checkbox working with the below code:
<textField>
<reportElement x="6" y="3" width="26" height="12" positionType="Float">
<property name="net.sf.jasperreports.export.pdf.field.type" value="Check"/>
<property name="net.sf.jasperreports.export.pdf.field.check.type" value="Check"/>
<propertyExpression name="net.sf.jasperreports.export.pdf.field.name"><![CDATA["Tested-" + String.valueOf(java.lang.Math.random())]]></propertyExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
</textField>
When the above checkbox is checked, I want the below date to be populated, and otherwise not.
<textField pattern="MM-dd-yyyy" >
<reportElement x="42" y="0" width="84" height="21">
<propertyExpression name="net.sf.jasperreports.export.pdf.field.name"><![CDATA["Date-" + String.valueOf(java.lang.Math.random())]]></propertyExpression>
<printWhenExpression><![CDATA[$F{test}.equals("Y")]]></printWhenExpression> <!-- THIS LINE DOES NO WORK. IT SHOULD BE TRUE WHEN THE CHECKBOX IS CHECKED. -->
</reportElement>
<textElement verticalAlignment="Middle"> <font size="8"/> </textElement>
<textFieldExpression ><![CDATA[(java.util.Calendar.getInstance().getTime())]]></textFieldExpression>
</textField>
Any help is much appreciated.
Thanks.