sreevidya.h Posted August 21, 2022 Share Posted August 21, 2022 Hi FriendsI 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 More sharing options...
mlopez_1 Posted August 25, 2022 Share Posted August 25, 2022 Take a look at this:https://community.jaspersoft.com/wiki/cascading-input-controls Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now