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

xdp & javascript problem

Avatar

Former Community Member

Hi,

I have this simple xdp file:

<?xml version='1.0' encoding='UTF-8'?>
<?xfa generator='AdobeDesigner_V7.0' APIVersion='2.2.4333.0'?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
<template xmlns="http://www.xfa.org/schema/xfa-template/3.1/">
<subform >
<event activity="ready">
<script contentType="application/x-javascript">
   app.alert({cMsg: "yes!", cTitle: "i am showing"});
</script>
</event>
</subform>
</template>
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<xfa:data>
<form>
<txtName>lll1</txtName>
<txtAddress>sss1</txtAddress>
</form>
</xfa:data>
</xfa:datasets>
<pdf href="smalltest.pdf" xmlns="http://ns.adobe.com/xdp/pdf/">
</pdf>
</xdp:xdp>

I would expect that the javascript is executed and the message is displayed. However that is not the case. I am trying to add some javascript code in there in order to put all fields to readonly. What am I doing wrong ?

4 Replies

Avatar

Level 10

Hi,

I am not sure how you inputted the script, but I would not under any circumstance recommend inputting script directly into the XML Source.

For example the syntax for the event is incorrect. Its more like:

<event activity="ready" ref="$layout" name="event__layout_ready">

Anyway as I say I would use the Script Editor as the main way of scripting objects.

Parallels Desktop1.png

You can open the Script Editor from the Windows menu in LC Designer and drag the bottom bar to make it bigger.

Good luck,

Niall

Avatar

Former Community Member

Thank you for your quick reply. The xdp xml is generated manually at server side so we cannot use the script editor to add this script. Looking in the xdp specification it seems this xml should work, but I have no clue why it doesn't. I tried your suggestion to modiy the xml but it still doesn't work.

Avatar

Level 10

Hi,

I am not up to speed on the server generated stuff, so can't offer much insight.

Hopefully someone will have a suggestion or you could also post to another LC forum, LiveCycle Workbench ES

Good luck,

Niall

Avatar

Former Community Member

Do you have a copy of Designer ...if so create the same form as a new form and then click on the XML tab and compare the XDP created by Designer to the one that you are creating.

If you do not have Designer I suggest that you download a trial version and use that.

paul