Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

RunAtServer script in XDP not executed in Form Server

Avatar

Former Community Member
Hi, Expert,



I authored the form template in Designer 7.1 and generated PDF using SOAP client call 'renderForm()' successfully on Form Server with JBoss 3.x.



The problem is that the script in the template written in Designer set as 'RunAt=Server' never gets executed in Forms Server (the script is triggered in the event like 'form:ready' and 'layout:ready').



Is there any special options which shd be set in renderForm() call or the properties of XDP?



Any help is highly appreciated.



Thanks in advance

John
7 Replies

Avatar

Former Community Member
Both of those events should fire on the server. Can you post a copy of your script here?



Rob

Avatar

Former Community Member
Hi, Rob,



Thank you very much for the reply.



I call the renderForm() is like:



IOutputContext context = formServer.renderForm(

args[0], // name of XDP file

"PDFForm", // for interactive form

xmlBytes, // merged XML data

"CacheEnabled=False", // runtime options

null,

"http://localhost:8080/",

"http://localhost:8080/", // sTargetURL

"file:///d:/formsapi", // path of XDP file

null);



The script in XDP run at server in form:ready is like:



if (txtProductId.rawValue == null || txtProductId.rawValue == "") {

// hide it

txtProductId.presence = "hidden";

}



Thanks again

John

Avatar

Former Community Member
Hello John,



I don't know about what doing the server-side scripting overall, but I noticed you set a field to "hidden". The hidden property excludes the field object from the layout, which from my understanding basically means the object isn't available for use at all. To just hide the field from displaying on the form, you would want to set it to Invisible.



That probably doesn't help your issue overall, but maybe will further down.



Good luck,

Jennifer

Avatar

Former Community Member
Hi, Jennifer,



Thanks for the reply.



Yes I use javascript in XDP to set field's presence 'hidden' if its value is null or empty. I want this scriptlet to be executed on server side (which is executed by javascript engine in Form Server rather than that in client-side Adobe Reader). My problem now is that PDF can be generated successfully but the scriptlet is not run by Form Server. So the field is still visible even its rawValue is empty after data merging.



John

Avatar

Former Community Member
Try changing your options string from "CacheEnabled=false" to "CacheEnabled=false&RenderAtClient=true". I think you need to generate a dynamic PDF to do this, and adding that option will make Forms render a dynamic one instead of a static one.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Hi, Chris,



Thank you very much for the reply.



I tried your solution by changing sOptions to "CacheEnabled=false&RenderAtClient=true" but it didn't work either. Yes form in XDP is a dynamic one and I set Server PDF Render Format to 'Dynamic PDF'.



I don't think there is something wrong in the script because previewed PDF shows the correct result after I change RunAt=Server to RunAt=Client.



Thanks again

John

Avatar

Level 2
John,



I had the same problem as you did, and I used your:



if (DateOfSale.rawValue == null || txtProductId.rawValue == "") {

// hide it

DateOfSale.presence = "hidden";

}



and it WORKED!



So - while it in no way contributes to this forum,

THANK YOU! THANK YOU! THANK YOU!!!!!