Skip to Content
Author's profile photo Prajesh Desai

Loop through all controls (fields) in adobe forms

in this dynamic world, client need all thing dynamic, changes according to the situation. and also want to reduce all manual efforts.

As our adobe having many types of controls (fields), requirement may come like change this or that according to this or that value. Here i want to deliver some javascript code and expenations for looping all fields including master pages and body pages.

pageContent() Method

pageContent( INTEGER param1 [, STRING param2 [, BOOLEAN param3 ] ] )

Where,

param1 : page index

param2 : control type (field, draw, subform, area, pageArea, contentArea, empty (default))

param3 : 0 (scan body page), 1 (scan master page)

for detailed information read pageContent() Documentation: Adobe LiveCycle Designer ES2.


For all intrective controls in Body Page:

Button, Check Box, Date/Time Field, Drop-down List, Signature Field, Image Field, List Box, Numeric Field, Password Field, Radio Button, and Text Field.

var oNodes = xfa.layout.pageContent(this.layout.page(this)-1, "field", 0);
var oNodesCount = oNodes.length;
for (var i = 0; i < oNodesCount; i++) {
  oNodes.item(i).<any property name> = <new value>;
}

For all intrective controls in Body Page:

Circle, Line, Rectangle, Static Image, and Static Text.

var oNodes = xfa.layout.pageContent(this.layout.page(this)-1, "draw", 0);
var oNodesCount = oNodes.length;
for (var i = 0; i < oNodesCount; i++) {
  oNodes.item(i).<any property name> = <new value>;
}

For all intrective controls in Master Page:

Button, Check Box, Date/Time Field, Drop-down List, Signature Field, Image Field, List Box, Numeric Field, Password Field, Radio Button, and Text Field.

var oNodes = xfa.layout.pageContent(this.layout.page(this)-1, "field", 1);
var oNodesCount = oNodes.length;
for (var i = 0; i < oNodesCount; i++) {
  oNodes.item(i).<any property name> = <new value>;
}

For all static controls in Master Page:

Circle, Line, Rectangle, Static Image, and Static Text.

var oNodes = xfa.layout.pageContent(this.layout.page(this)-1, "draw", 1);
var oNodesCount = oNodes.length;
for (var i = 0; i < oNodesCount; i++) {
  oNodes.item(i).<any property name> = <new value>;
}

Hope this helps.

Assigned Tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jagesh Lakdawala
      Jagesh Lakdawala

      Too Good!!

      Author's profile photo Sap abap
      Sap abap

      Hi Prajesh,

      I want a help from you on a issue of Page Numbering.

      it is a adobe form issue- I have nested table and based on the index change of first table there is a page break now the requirement is if there is page break then page number shoulf reset say for first iteration it has 2 pages then it will print as 1 of 2 2 of 2, after page break say there are 3 pages then 1 of 3 2 of 3 3of 3 like,,,i m not able to find solution for this..could you pls help me

      Author's profile photo Prajesh Desai
      Prajesh Desai
      Blog Post Author

      you must go for scripting logic for this. there is nothing available as per my knowledge.

      Hope this helps.

       

      Author's profile photo Sap abap
      Sap abap

      Hi,

       

      I solved with Javascript only.

      Author's profile photo Suresh Kumar Sivasubramani
      Suresh Kumar Sivasubramani

      Hi Can you let me know how you solved this ?, I have a similar requirement, can you share your javascript code for your solution?,

      I have started a discussion, but so far no replies,

      link: https://answers.sap.com/questions/276453/restart-page-numbering-for-paginated-forms-at-cond.html

      if you can, please answer in the above link so that it can be found much easily by others.

      Thanks a Lot!

      Suresh Kumar S

      Author's profile photo Former Member
      Former Member

      Hi Prajesh,

      First I want to thank for this blog.

      Please help me for the below scenario.

      I have a deep table with multiple header records and each header record in that table is having it's own item table. I want to print header data in master page since it has to print in top of all the pages. Please help me to make the header fields to be filled dynamically based on the first item records printing on the each page.

      All the data should print in single PDF document.

      Thanks in advance.

       

      Uday

      Author's profile photo Prajesh Desai
      Prajesh Desai
      Blog Post Author

      not getting you exactly, but for nested table Adobe Forms Nested Tables.

      Hope this helps.

      Author's profile photo Nitin Sikka
      Nitin Sikka

       

      hi,

       

      I want to basically sort the content of a table using script. can you please suggest?

      Author's profile photo Prajesh Desai
      Prajesh Desai
      Blog Post Author

      I suggest you to send sorted data to adobe forms. I never prefer sorting in scripting as it is very easy with our abap code. You can you interface level abap code for not making it complex.

      Hope this helps.

      Author's profile photo KKP Kumar
      KKP Kumar

      Hi Prajesh,

      Can you please help with below scenario:

      I ha ve requirement like when user click on button it picks the position number based on position I am filling Qualification details, Here one field called Degree which is drop down, I want to modify this field property Read only and choose value. If position have degree level already in Org structure I need to set Degree field read only. If org structure don't have value I have to enable that drop down to chose one.  I have kept below code it is working first time like if first time position chosen if it don't have the value drop down coming, and if i chose which have the value it is setting to read only if I do again which don't have degree level it setting to display only and not clearing old value.

      This code written in Java Script & Client and Serve level.

      if (xfa.resolveNode("data.EmploymentAndEducation.Education.FIELD[1]").rawValue != null) {
      xfa.resolveNode("data.EmploymentAndEducation.Education.FIELD[1]").access = "readOnly";
      } else {xfa.resolveNode("data.EmploymentAndEducation.Education.FIELD[1]").access = "";}

       

      Please help. Thanks

       

      Author's profile photo KKP Kumar
      KKP Kumar

      Resolved my self.. Using ABAP code after filling value kept condition to clear it. Thanks,

      Author's profile photo John Fredy Gonzalez Bran
      John Fredy Gonzalez Bran

      Buenas tardes,

      En un formulario Formularios Adobe envió en una tabla un campo tipo tabla TSFTEXT (TLINE), necesito recorrer esta y asignarla en un texto dinámico.

       

      Tabla

       

      Como puedo recorrer la tabla y asignarle los datos del campo al texto dinámico, actualmente solo me lee un registro del campo.

      Campo% 20tabla

       

      Se asigna el campo de lectura, pero solo recupera un registro

      Recuperar

       

      Como puedo recorrer la tabla y asignar los datos del campo tipo tabla texto, si se asigna directamente solo muestra un dato.

      Muchas gracias.