Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Master Pages and Subforms

Avatar

Level 4

Any help is appreciated!

I have created a form with 4 master pages. The first one contains a subform of summary data. It only occurs once. The 2nd master page contains a subform of many data fields. This master page is restricted to 30 occurances. The 3rd master page is a summary of certain data from the 2nd master page. The 4th occurs only once and contains only the data from a "yes" answer on the 30 occurances of the 2nd master page.

I need to have certain fields (example Trade Name) from Master Page 2 populate a column of 30 blanks in a table on Master Page 3. How do I have each "Trade Name" occupy a separate blank in the table?

Also, if a user checks "yes" on one of the 30 occurances of Page 2, is there a way to have all of the data from these sheets populate to Master Page 4?

I hope I explained this intelligently!

Thanks


Gene-O

1 Accepted Solution

Avatar

Correct answer by
Level 10

It took some time to look at your file and understand the requirement..Here are my observations..

  • First I gave a proper name to Master Pages in the heirarchy. Selected the "(Master Pages)" below form1 in heirarchy and renamed it to "Master Pages". This gives a cleaner approach in the code while referencing the controls.

  • Supervisor Initials field has the name as LicenseNo, I renamed it to SupervisorInitials to avoid confusion in referencing the fields.

  • Commented out the code in "form1.MasterPages.Page2.SummarySheet.Successful::exit"
    //if"Successful"="No"then"Desc"=hidden;

  • I changed the target version to Acrobat or Reader 8.0 or later, because lot of things are not supported in 7.0.


To fill the Licensed Locations section..
  1) It would be better replace the textboxes in 30 rows with a table rows.


  2) When you do that the left column you can use for Serial Numbers. Currently you had put a text and vertically you are entering the serial numbers.


  3) Since your form is a static form, you can write the script in the exit event of the controls (for example Trade Name) in 2nd Master pages to fill the corresponding field in the "Licensed Locations section" page.


  4) Simialrly for Type and License#, you need to write the same script in the click event of the LicenseType radiobutton and also the exit event of the License Number field to concatenate both the values and populate the corresponding field in the "Licensed Locations section" page.


  5) Do the same thing for Address field


To fill the "Tobacco Compliance Check Detail" page...


1) You need to write the code in the click event of the "Successful Purchase" radio button to populate the corresponding fields in the table.

   I have placed some sample code to populate Trade Name, License No, Date and Time in the attached file. You can check the code in the events
"form1.MasterPages.Page2.SummarySheet.Successful.SuccYes::click" and "form1.MasterPages.Page2.SummarySheet.Successful.SuccNo::click"

   To test the file, Open it in Reader/ Acrobat, enter values for Trade Name, License No, Date and Time and click on Yes for Successful Purchase. Check for the Non-Compliance Table with the data entered.  If you select No then the values will be deleted for that row.

Hope this can help you..

https://acrobat.com/#d=b52fVl5XbRfZTHqGmuDQpA

Thanks

Srini

View solution in original post

20 Replies

Avatar

Level 7

Can you post your form so it can be looked at? You can upload it to acrobat.com using these steps:

1) goto acrobat.com website
2) login with your Adobe login/password.
3) In Actions you will find Upload. Select your form and upload.
4) After uploading, select form name in All Files section and right click and select share.
5) Check the checkbox "Allow anyone with a link to view this document".
6) Copy the URL link and post it in the forum.

Thank you to Srini for posting the upload tutorial in another post.

djaknow

Avatar

Level 4

I do not see any way to upload the form. I don't see "Actions". Can you direct me?

Avatar

Level 10

You need to select "FILES"  on the top left border to get the Action menu.

Thanks

Srini

Avatar

Level 4

Here is what I am trying to do:

Page 1 is a coversheet. Some of the information will calculate, some will be filled in by the user

Page 2 is a detail sheet, there are 30 of them. Some information will calculate from the coversheet, some will be filled in by the user

Page 3 is a non-compliance sheet. I would like for the infromation from the 30 page 2s that have been checked "Yes" under "Successful Purchase" to populate to this page

Page 4 is a listing of all visited locations. I would like for ALL of the pertinent information from the 30 page 2s to populate to this page.

https://acrobat.com/#d=hQnlWrkLL6wGc*f2xZ1yhA

Any and all help is greatly appreciated!!

Gene-O

Avatar

Correct answer by
Level 10

It took some time to look at your file and understand the requirement..Here are my observations..

  • First I gave a proper name to Master Pages in the heirarchy. Selected the "(Master Pages)" below form1 in heirarchy and renamed it to "Master Pages". This gives a cleaner approach in the code while referencing the controls.

  • Supervisor Initials field has the name as LicenseNo, I renamed it to SupervisorInitials to avoid confusion in referencing the fields.

  • Commented out the code in "form1.MasterPages.Page2.SummarySheet.Successful::exit"
    //if"Successful"="No"then"Desc"=hidden;

  • I changed the target version to Acrobat or Reader 8.0 or later, because lot of things are not supported in 7.0.


To fill the Licensed Locations section..
  1) It would be better replace the textboxes in 30 rows with a table rows.


  2) When you do that the left column you can use for Serial Numbers. Currently you had put a text and vertically you are entering the serial numbers.


  3) Since your form is a static form, you can write the script in the exit event of the controls (for example Trade Name) in 2nd Master pages to fill the corresponding field in the "Licensed Locations section" page.


  4) Simialrly for Type and License#, you need to write the same script in the click event of the LicenseType radiobutton and also the exit event of the License Number field to concatenate both the values and populate the corresponding field in the "Licensed Locations section" page.


  5) Do the same thing for Address field


To fill the "Tobacco Compliance Check Detail" page...


1) You need to write the code in the click event of the "Successful Purchase" radio button to populate the corresponding fields in the table.

   I have placed some sample code to populate Trade Name, License No, Date and Time in the attached file. You can check the code in the events
"form1.MasterPages.Page2.SummarySheet.Successful.SuccYes::click" and "form1.MasterPages.Page2.SummarySheet.Successful.SuccNo::click"

   To test the file, Open it in Reader/ Acrobat, enter values for Trade Name, License No, Date and Time and click on Yes for Successful Purchase. Check for the Non-Compliance Table with the data entered.  If you select No then the values will be deleted for that row.

Hope this can help you..

https://acrobat.com/#d=b52fVl5XbRfZTHqGmuDQpA

Thanks

Srini

Avatar

Level 4

Srini,

YOU ARE MY HERO!!!

It has become apparent that I need to learn Java!

Thank you so much for your help!!! If I may burden you with one more question:

On Page1, there is a field called "Cost of Evidence". I would like for this to be a calculated dollar amount that is the sum of all of the Page2 fields called "Price". I can add fields on the same form, but cannot figure out how to add them up from difference instances of this subform.

Do you mind to help me with that one too?

Thank you soooooo much!!!

Gene-O

Avatar

Level 7

Try this on the calculate event of your Cost of Evidence field:

var jpt = xfa.form.form1.subformName.resolveNodes("childSubformName[*]"); //count the number of instances

var vSum = 0.0

for (i = 0; i < jpt.length; i++) vSum += jpt.item(i).resolveNode("fieldName").rawValue; //cycle through all instances and total the values

this.rawValue = vSum;

Avatar

Level 10

Here is the sample file.. You can find the code in the Calculate event of Cost of Evidence field..

As djaknow mentioned in his reply, you need to use resolveNodes to get access to ALL the occurences of a repeating subform.

In your form, I wrote the code like below.

     var vPriceFields = xfa.resolveNodes("MasterPages.Page2[*].SummarySheet.Price");

and then you can loop thru the nodes of Price field to get the rawValue..

You can reuse the same approach to get value of any field in the 2nd Master Page.

https://acrobat.com/#d=GzLRPA2xz0-u7YWIvAX5Vg

Thanks

Srini

Avatar

Level 4

thank you thank you thank you!!!!

You both have been very helpful! I appreciate it.


Gene-O

Avatar

Level 4

I hate to say it, but I found a problem:

The form populates the Non-Compliance Location Listing form as indicated by a "yes" on theCompliance Check Summary Sheet. BUT: if the first Summary Sheet is a "yes", the second is "no", and the third is "yes", the Non-Compliance sheet produced a blank row between these the first and third entries. Is there any way to make the entries move up and not have any blank rows?

Thanks!!!

Gene-O

Avatar

Level 10

Yes you can..You need to place the code to "Hide" the Row if you select No.

    

     objRow.presence = "hidden";

Currently the code is placed in the Click and Initialize event also to make sure when you open the saved file to behave the same way as before.

Check the file below..

https://acrobat.com/#d=sf8olFgy8JYKWVtaLxPkBw

Thanks

Srini

Avatar

Level 4

I'm still having problems.

Here is the new file: (I made a few changes since the last one was uploaded)

https://acrobat.com/#d=XLf2w7S1QAfp-SkJSrpVUw

I am getting it to populate the chart, and blank out the row in a "no" answer, but not move the next "yes" information up to not have a blank row in the chart.

Thanks!

Gene-O

Avatar

Level 10

Did you get this issue resolved or still have issues with it..

Thanks

Srini

Avatar

Level 4

Unfortunatley, I am still having the issue mentioned in my last post. When a "yes" answer is checked, the form populates the chart. When a "no" answer is checked, the form does not populate the chart. However, there will be a blank row in the chart whenever a "no" answer is checked. I need to eliminate the blank rows.

Thank you sooooo much!

Gene-O

Avatar

Level 10

Please find the modified file in the share..This will not add the empty rows if you choose No.

https://acrobat.com/#d=NrRh3qfoybovCcR2tXus7A

Thanks

Srini

Avatar

Level 4

Srini,

When I clicked on "no" on Page 2, I got the following:


GeneralError: Operation failed.
XFAObject.removeInstance:58:XFA:form1[0]:MasterPages[0]:Page2[2]:SummarySheet[0]:Successful[0]:SuccNo[0]:click
Argument mismatch in property or function argument

I have NO IDEA what this means. Can you help?

Thanks


Gene-O

Avatar

Level 10

There was a small correction in the code.. You can try with this file..

https://acrobat.com/#d=iZ6THFdQ8CrDBEXw2prszw

Thanks

Srini

Avatar

Level 4

Srini,

I am sorry for the delay, I was pulled off onto another project for a while.

I'm sure I have messed up your code somehow. Here is another link (please use this one, not previous files):

https://acrobat.com/#d=mzWyD8fle0zMHeM9mCG9jQ

I am getting the following errors:

Syntax Error on Page 2, SuccYes: click

No Properties on Page 2, SuccNo: click

Also:

The table on Page 3 is not populating at all. It should populate with the data from each Page 2 ONLY when SuccYes is checked, without blank lines in between entries.

The table on Page 4 will not populate past the first entry from Page 2. It should contain all of the appropriate data from each occurance of Page 2.

thanks for all of your help!!

Gene-O

Avatar

Level 10

Please find the updated document to fix the issue when you click on Yes/ No..

You had copied the code from the XML Source of the previous file to your Click event, which you should not. Because XML Source will have other XML tag elements which does not need to be in the Script editor.

I removed the XML tags from your Click event and the issue is resolved.

https://acrobat.com/#d=iDx3dOazEEtsl9EHyUjJLA

For the Page3 issue, I had resolved it in the previous file itself which you can go thru in the below file..

https://acrobat.com/#d=KliSH-B5fZl-*NANLZYbOQ

For Page4 issue, you need to write code in Exit event of each of the apropriate Text field in Page2 to populate a corresponding Text field in Page4. This will be a direct one to one value assignment..

Hope this helps.

Thanks

Srini