Expand my Community achievements bar.

SOLVED

Change Caption Text on formready (run at server)

Avatar

Level 2

Hi

We need to change the caption text of a text field as following:

(formready, run at server, javascript)

TextField1.caption.value.resolveNode("#text").value = "hello";

It is a dynamic form and we are using LC Forms ES 8.2 on a Windows platform.

The problem is that the caption DOES NOT change the caption text if it runs ON THE SERVER. If I change it to run it on the client (e.g. Acrobat 9, PDF Preview of the LC Designer) it does work.

Many thanks for your inputs!

Daniel

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Set your renderAtClient to No or False (I do not remember the specific setting). If you leave it as auto then you are allowing the form to decide (Form Properties/Deafults). If the form is dynamic then by default it will render at client and not on server.

Paul

View solution in original post

15 Replies

Avatar

Level 6

Daniel, just tried your issue in a form I'm working on and it worked fine.  Text field under a subform, javascript in the subform's form:ready event.  Are other dynamic scripts in the form working OK when you're rendering on the server?

Avatar

Level 2

Hi Kevin

Thank you for your answer. I have exactly what you are describing. Other scripts are working fine because I am "tailing" my server.log file and there is no other output.

Have you got set "Run At: Server and Client"? If I do so it works fine. Otherwise I set it to "Run At: Server" at it does not work.

Any ideas? Thank you.

Daniel

Avatar

Level 6

Runat Server works fine.  What are your rendering options set to in FormsService?

Avatar

Level 2

Hi Kevin

I attached my LiveCycle Forms Settings, a screenshot of the form properties and a screenshot of the form itself. I hope that this helps. Thank you.

Daniel

Avatar

Level 6

I can reproduce your issue, but I'm not sure how to tell you to fix it.  There's a setting on the FormsService QPAC called Form Model.  I have it set to "Auto", which works OK.  I can get your sample to fail if I set the value to "Client".  Here's the info from Workbench ES Help about the setting:

Form Model: Sets the type of scripts embedded in the form that are to be executed. The following values are valid and the default is Auto.

Auto: The Forms service checks the form to determine where the form design is to be rendered.

Both: The form is rendered on both the server and the client.

Client: The form is rendered on the client. If there are scripts in the form design that are run on the server or on both the server and client, a warning is generated on LiveCycle ES.

Server: The form is rendered on the server.

Unfortunately I don't know if the setting is exposed in the web-based Admin tool. I don't see a setting for it (it's not the Render At setting).  Mine is set directly in the render options in the QPAC.  I've attached a screenshot of the render options in the renderPDFForm operation.  Is it possible that yours is set to "client"?

Avatar

Level 2

We are calling Forms ES through the EJB interface. The PDF form rendering specification is set as following:

PDFFormRenderSpec pdfFormRenderSpec = new PDFFormRenderSpec();

pdfFormRenderSpec.setCacheEnabled(new Boolean(false));

pdfFormRenderSpec.setLocale("de_CH");

pdfFormRenderSpec.setRenderAtClient(RenderAtClient.Auto);

As you can see we set the "RenderAtClient.Auto" option. I think this should be ok like this because the default text of a text field can be changed at the server but the caption of a text field does not change. Have you got any other ideas? Thank you.

Avatar

Level 6

Daniel, try adding the following line to your invocation:

pdfFormRenderSpec.setFormModel(FormModel.Auto);

I'm not positive about the enum naming but I believe FormModel.Auto will be correct.

Kevin

Avatar

Correct answer by
Former Community Member

Set your renderAtClient to No or False (I do not remember the specific setting). If you leave it as auto then you are allowing the form to decide (Form Properties/Deafults). If the form is dynamic then by default it will render at client and not on server.

Paul

Avatar

Level 2

Hi Paul

This works! We set

pdfFormRenderSpec.setRenderAtClient(RenderAtClient.No);

and now the caption text is changed ON THE SERVER!

Many thanks to you and Kevin!

Best regards,

Daniel

Avatar

Level 6

Paul, can you explain the difference between the RenderAtClient setting and the FormModel setting?  According to the documentation, it seems that they somehow conflict.  Maybe I'm not understanding the docs.  What happens if I have a dynamic PDF, RenderAtClient is set to Yes and FormModel is set to Server?

Avatar

Former Community Member

To explain this we must understand what is happening when a form is render. The XDP (template) is interpretted and in doing so to run any script the form model, and data model are created on the server. Once the data is merged and the scripts are run then the final PDF is created.

The RenderAtClient is used for dynamic forms only. It will package up a wrapper PDF with the XDP and the data inside of it and send that to the client where Acrobat/Reader will open th ePDF and render the form locally. This is a tremendous performance improvement if you can run this way as the server only has to do file manipulation. Rendering at Client is the default behaviour.

If you know that there is no scripting invovled in the form then if you can tell the program to bypass the creation of that form model and data model then there are performace gains there as well. That is what Form Model does. It allows you to control whether this part of the rendering takes place (regardless of server of client).

I am not 100% sure of the interaction between the two but I am trying to find out. I will update this post when Ido get something.

Paul

Avatar

Level 1

Paul,

Is it possible to use just LiveCycle Forms and LiveCycle Process Management (ES 2.5) and have a PDF Form button click event script run on the server?

I would like to call a web service to populate a form, but the form isn't Reader Extended.

If it is possible, what do I need to setup on the Form, and in the render process to allow this to happen?

Regards,

Tim.

Avatar

Former Community Member

Yes ...you woudl set the code on the button to execute serverside .....then when the button is clicked the data woudl be submitted to the server, the form woudl be rendered (on the server), the WS woudl be executed and the returned value would come back to the form, the form, woudl be updated on the server and then returned to the client .....so you woudl be doing a round trip each time the button was pressed.

Note that this type of environment is very difficult to debug if something goes wrong.

Paul

Avatar

Level 1

Paul,

Thanks for your answer.

What URL does the form need to submit to for this to work, I assume it would be talking to LiveCycle Forms?

I would create a simple form with a regular button with the server-side script to catch the click event, and presumably also a submit button with the LiveCycle Forms URL?

I don't understand how the server-side script button (or Reader) knows where to make the server-side request to if it isn't in a submit button...

Regards,

Tim.

Avatar

Former Community Member

You will need a servlet that calls the Form Servers ProcessFormSubmission method. This will determine which button was pressed do the rendering and return back the finished PDF. I woudl use the FormsIVS sample that ships with the product (to give you a feel for what you are trying to do)  before trying this on your own

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----