Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

print button not working w/mandatory checkbox

Avatar

Level 2

I have a form with a mandatory checkbox at the end of form that prevents the user from submitting the form unless they click the acknowledgment that is working great.

My is issue is the print button is not working - what sort of javascript should be included so that the form will print?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi, the source shoul look like:

<field name="CheckBox1" y="254.043mm" x="6.177mm" w="189.44mm" h="6mm">

            <ui>

               <checkButton>

                  <border>

                     <fill>

                        <color value="255, 255, 255"/>

                     </fill>

                     <?templateDesigner StyleID apcb1?></border>

               </checkButton>

            </ui>

            <font typeface="Myriad Pro"/>

            <margin leftInset="1mm" rightInset="1mm"/>

            <para vAlign="middle"/>

            <caption placement="right" reserve="182.44mm">

               <para vAlign="middle" spaceAbove="0pt" spaceBelow="0pt" textIndent="0pt" marginLeft="0pt" marginRight="0pt"/>

               <font size="8pt" typeface="Arial" baselineShift="0pt"/>

               <value>

                  <text>Please certify that this abstract does not contain classified information.</text>

               </value>

            </caption>

            <items>

               <text>1</text>

               <text/>

            </items>

            <validate nullTest="error"/>

         </field>

View solution in original post

7 Replies

Avatar

Level 2

I am working with a checkbox and not a textfield.

I am not getting the same result with the checkbox, the print button is still not working.

Avatar

Level 2

Is there someone I can send this form to in order to troubleshoot this print button!!!!!

Avatar

Level 10

This method also works with a check box, but you need to modify it.

1. select the checkbox and switch to the XML source view.

2. Add the validate tag to the source of the check box.

<field name="ChkBox" y="6.35mm" x="6.35mm" w="43.2054mm" h="6mm">

            <ui>

               <checkButton>

                  <border>

                     <edge stroke="lowered"/>

                     <fill/>

                  </border>

               </checkButton>

            </ui>

            <font typeface="Arial"/>

            <margin leftInset="1mm" rightInset="1mm"/>

            <para vAlign="middle"/>

            <caption placement="right" reserve="28.6004mm">

               <para vAlign="middle"/>

               <value>

                  <text>Check Box</text>

               </value>

            </caption>

            <items>

               <text>1</text>

               <text>2</text>

            </items>

            <validate nullTest="error"/>

         </field>

3. Go back to the design view and open the binding tab. It displays two values for your check box: 1 for On and 2 for Off.

4. Delete the value for off, so the field is just blank.

Now you cannot print until the check box is activated.

Avatar

Level 2

It is not working, this is what my source code looks like:

<field name="CheckBox1" y="254.043mm" x="6.177mm" w="189.44mm" h="6mm">

            <ui>

               <checkButton>

                  <border>

                     <fill>

                        <color value="255, 255, 255"/>

                     </fill>

                     <?templateDesigner StyleID apcb1?></border>

               </checkButton>

            </ui>

            <font typeface="Myriad Pro"/>

            <margin leftInset="1mm" rightInset="1mm"/>

            <para vAlign="middle"/>

            <value>

               <integer>0</integer>

            </value>

            <caption placement="right" reserve="182.44mm">

               <para vAlign="middle" spaceAbove="0pt" spaceBelow="0pt" textIndent="0pt" marginLeft="0pt" marginRight="0pt"/>

               <font size="8pt" typeface="Arial" baselineShift="0pt"/>

               <value>

                  <text>Please certify that this abstract does not contain classified information.</text>

               </value>

            </caption>

            <items>

               <integer>1</integer>

               <integer>0</integer>

               <integer>2</integer>

            </items>

            <event activity="initialize" name="event__initialize">

               <script contentType="application/x-javascript">

    this.mandatory = "error";

    this.mandatoryMessage = "Must certify that this abstract does not    contain classified information before submitting!";

</script>

Avatar

Correct answer by
Level 10

Hi, the source shoul look like:

<field name="CheckBox1" y="254.043mm" x="6.177mm" w="189.44mm" h="6mm">

            <ui>

               <checkButton>

                  <border>

                     <fill>

                        <color value="255, 255, 255"/>

                     </fill>

                     <?templateDesigner StyleID apcb1?></border>

               </checkButton>

            </ui>

            <font typeface="Myriad Pro"/>

            <margin leftInset="1mm" rightInset="1mm"/>

            <para vAlign="middle"/>

            <caption placement="right" reserve="182.44mm">

               <para vAlign="middle" spaceAbove="0pt" spaceBelow="0pt" textIndent="0pt" marginLeft="0pt" marginRight="0pt"/>

               <font size="8pt" typeface="Arial" baselineShift="0pt"/>

               <value>

                  <text>Please certify that this abstract does not contain classified information.</text>

               </value>

            </caption>

            <items>

               <text>1</text>

               <text/>

            </items>

            <validate nullTest="error"/>

         </field>