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


Level 3


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,


3 Replies


Former Community Member


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">


               <button highlight="inverted"/>


            <font typeface="Myriad Pro"/>



                  <text>Do Something</text>


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


            <border hand="right">

               <?templateDesigner StyleID apbx2?>

               <edge stroke="raised"/>


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



            <bind match="none"/>

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

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

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






Level 10


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,



Level 3

YES! Thanks Niall!!!!

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

Thanks again,