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

Print all the code

Avatar

Level 3

HI,

I have a form with buttons and the associated code. Is there an easy way to print out all the code for all the buttons? Like...can I just output all that code to a text file so that I can study it and keep it as a code reference?

Many Thanks,

Joe

3 Replies

Avatar

Former Community Member

Joe,

I think the closest you can come is to take the XML source, save it externally and write XLST to extract the button fields. Form objects are differentiated by the <ui> element. For a button the child of <ui> is <button>. You could then extract the <script>.

         <field name="btn" y="22.225mm" x="44.45mm" w="28.575mm" h="6mm">

           <ui>

               <button highlight="inverted"/>

            </ui>

            <font typeface="Myriad Pro"/>

            <caption>

               <value>

                  <text>Do Something</text>

               </value>

               <para vAlign="middle" hAlign="center"/>

            </caption>

            <border hand="right">

               <?templateDesigner StyleID apbx2?>

               <edge stroke="raised"/>

               <fill>

                  <color value="212,208,200"/>

               </fill>

            </border>

            <bind match="none"/>

            <event activity="click" name="event__click">

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

xfa.host.messageBox("I do something.");

</script>

            </event>

         </field>

Steve

Avatar

Level 10

Hi,

If you select the root node ("form1" by default), then in the script editor select "Events with script". In the editor select all Control+A and copy. The result when pasted into a text file will include the objects, events, language and script.

Good luck,

Niall

Avatar

Level 3

YES! Thanks Niall!!!!

Logical. Easy. That works. Why didn't I think of that?

Thanks again,

Joe