Copy link to clipboard
Copied
As a fledgling scripter, I'm creating a PDF form that acts as a calculator from which lay-user can compare a few similar consumer products based a couple variable choices they may make. Within the form, I have built a hidden input form to which a [non-developer] Admin can adjust the data in fields of each of the displayed choices before hiding the input form and distributing to the intended lay-users who would use the calculator to make consumer choices. This whole project is coming along nicely, as I intended. But, my question...
Is it possible to "group" fields in a way that would allow me to treat them as one for the purpose of making visible or hidden? Example, in that hidden Admin-input form, each of 4 potential products has, say, 25 fields in which the calculable source data may be changed by Admin before distribution. So, currently, if I have 4 products to compare, I have 100 individual fields to make visible/hidden based on Admin's password field and button. My current script makes each of the 100 fields visible/hidden, fine. But, it would be so much easier if, say, product No. 1's 25 respective fields could be named "fieldGroup1" and then script the visible/hidden functions with just that one group field name instead of the tedious scripting and calling all 25 individual fields in a block of script.
Hope this is clear - and much thanks to any ideas (or, even if I'm told it cannot be done).
Yes, it's possible to group fields by naming them like this:
Group1.Field1
Group1.Field2
Group1.Field3
You can then access all the fields in the group like this:
this.getField("Group1")
Or a specific field like this:
this.getField("Group1.Field2")
Copy link to clipboard
Copied
Yes, it's possible to group fields by naming them like this:
Group1.Field1
Group1.Field2
Group1.Field3
You can then access all the fields in the group like this:
this.getField("Group1")
Or a specific field like this:
this.getField("Group1.Field2")
Copy link to clipboard
Copied
Wow. Thank you! This is much simpler and logical than I expected!
Copy link to clipboard
Copied
If you create on field and then use the "Create Multiple Copies" the fields will automatically have a dot number value starting at zero applied to each field name starting with the selected field and through the number of fields created. This form of naming field is known as hierarchical field naming. The parent field is the field name without the suffix can can be accessed like any field. Any change to a common property of the field will change all the fields, children, under this field. It is also possible to create an array of the children fields using ".getArray()" method. Using this array will allow one to access is child field object as an individual field which is useful when using a for loop to step through a group of fields.
Copy link to clipboard
Copied
Thank you! This will cut the development time into fractions (especially for this noob)!