Access Mode and Presence of Fields on Adobe Interactive Forms
I was asked several times now how to change the access mode or the presence of a field on an Adobe Interactive Form so I decided to discuss these two topics.
Access Mode of Fields
Let’s start with the access mode. Assume that a field named TextField1 has to be set to read only mode or to be editable. The XFA technology offers four levels of access modes (see page 491, XFA Spec 2.2). For simplicity, I use only two modes in this blog.
To change the access mode of a field (read only/editable) you have to set the property “access”.
TextField1.access = “readOnly”;
TextField1.access = “open”;
For the access mode example the FormCalc script code looks almost the same. You can omit the semicolon.
Presence of Fields
Now, let’s look at the presence of a field. You can set the presence either by scripting or you can use a data driven approach. If possible I would recommend using a data driven approach.
A field can be visible, invisible or hidden (takes no space on the form layout).
TextField2.presence = “invisible”;
TextField2.presence = “visible”;
Note that the PDF has to be rendered as a dynamic PDF to make this work. If you have a PDF (e.g. saved from a WebDynpro app and sent to you) and you don’t know if it’s a static or a dynamic PDF you can open it in Designer and try to safe it with another filename (Save As). When the “Save As” dialog comes up look for the “save as type”. You can find it directly below the file name. Look for a “static” or “dynamic” in the type. Then you know.
A Data-driven Approach to Set the Presence
As scripting takes some time to execute it is worthwhile to think about controlling the presence of a field or a group of fields by data. You can use a subform whose min occurence is set to 0 what means that it does not appear if the data the subform is bound to does not exist. To understand the concept I suggest repeating the following example.
Create a data file that looks as follows with your favorite XML editor or simply a text editor:
Now, open Designer and create a new form. Press the new button then drag a subform on the body page. Select the body page (page 1) in the hierarchy and then go to “object”, go to “Subform” and make the content “Flowed”. Create a data connection with the sample xml file you created before. Then, select the subform you dragged on the form (normally Subform1) and go to the “Binding” tab. There you have to bind the subform to “$record.existing” and check the “Repeat Subform for…” and make sure that there is no min count. Open the data view and drag the text field for the node “name” on Subform1. Open the form properties dialog and go to defaults. There you have to specify a data file for the preview. Look at the form in the preview tab.
To see how this example works, simply rename the data node “existing” to “existing2”. Go back to Designer and open the preview tab again. The subform with the text field for the name disappeared. You can make the subform reappear by renaming the data node back to “existing”.
The XFA technology is even more powerful. You can use choice subforms to let data determine the order of subforms. For tables this concept is called table sections. Please let me know if there is interest in a blog about that.
The properties and their values discussed in this blog are documented in the XFA Specification which can be found here:
Go to Part 2 and then to Template Reference.
This blog is based on version 2.2 of the XFA Spec.
You mentioned XFA document. Can you please send me a link for that.
I found the XFA documentation.
Great blog so I know more about the concept of binding data to a form using XML schema.
I hope you can also give some examples of table sections!
Thanks for publishing this blog. In the example that you have given, if I have multiple names and I would like to display in a tabular format I could display them but it displays without column headers. Can you please advice me how I can display a coulmn header using subform for dynamically displaying the record data.
when you drag&drop a table from the "standard" library on a form a dialog is shown. In this dialog there is a check box "Include Header Row in Table" you have to mark that one.
Thanks for you reply. You are right, the table control has got the header column but my understanding is that we can't use the table control for displaying the dynamic data. I have used the nested subforms with flow content to display the grid. Using this technique I could display the data in grid format but I could not display the header. I have also tried to create a table with one header column and one data column and include the nested subforms in the first data row. This displayed the dynamic content but not in multiple table rows. Can you please advice me here.
I resolved the issue using Dynamic tables.
Thanks for the blog. It has been of great help!!
I am facing a problem with the usepdf mode.
I have a adobe interactive form saved in the java dictionary table(as binary).
This form can contain attachements & signatures.
Now, depending on which user('role' of user) logins into the webdynpro java application & tries to view the form, i need to set the visiblity of a few subforms within the form.
For this to be possible, i need to pass the user-role/name to the form(using the context node).
To achieve this, i need to open this form in UpdateDatainPDF mode. But if i do this, i wont be able to see the attachemnts/signatures,etc of the original form.
But if i use usepdf mode, then i wont be able to pass user-role/name to the form & so wont be able to change the visisbility of the subform.
How do i solve this problem??!!!!
Could you please post the question on the Interactive Forms forum on SDN? People on that forum might be able to answer your question.
I know that you could be using scripting to show and hide subforms. But you would need to find a way to push the user information to the form (as part of the data).
I have a problem with extracting data from BIW Infocube and populate certain field in the interactive form...
My problem being; I cant read the Infocube since it is not a Flat Structure, is there a simple way of extracting the data from the Infocube and do what i'll able to do with the Normal Sap Table.
The other thing is, the RRW3_GET_QUERY_VIEW_DATA FM, i'v been trying to extract data from the queries which reference the Infocube, but it returns inconsistent data, like when i use the I_PARAMETER function, it cannot be able to bring filtered values.
I can't help since I have no experience with BIW.