Jump to content
Changes to the Jaspersoft community edition download ×

Retrieving values of editable fields


sreevidya.h

Recommended Posts

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.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...