Expand my Community achievements bar.

How do I increment a counter in a sub-form?

Avatar

Level 2

I have a subform that contains a field named Service_Location.  I want the value to default to 1, and increment by 1 each time I add a new instance of the subform using Designer ES-4.  I am a newbie to Designer, and do not "speak" Java.

Suggestions?

25 Replies

Avatar

Former Community Member

2. What you have to do is to create a master page that will only repeat max 1 time, you put your hidden counter in it and it will increase just like you want it to.

3. read the topic i sent, you will understand how to change the value of your thing in every instance of it.
http://forums.adobe.com/message/5194920

Avatar

Former Community Member

Aren't you missing this after your addinstance?

xfa.form.recalculate(1);

Max

Avatar

Level 2

Max,

In the Designer 11 Scripting Basics / Events / Click Event, there is a note that states:

You cannot place a calculation or script on the CLICK event of a submit button because the calculation or script will override the calculations and scripts on the preSubmit event for a submit button.

In order to get my counter to increment correctly, could I use indexChange event script instead?  I am still trying to get multiple master pages figured out.

Is there a way to share this file with you so you can see what I am up against?

Anokie1

Avatar

Former Community Member

You are using the wrong button. Use the simple "Button" instead of the "Submit Button". This might be your problem.

I think that you can upload your pdf and if i open it in livecycle i should see your coding.

Max

Avatar

Level 2

Sorry - I haven't used the "Submit Button."

Here is the URL for the file.   https://workspaces.acrobat.com/?d=66B5k8981-WUNHJB1epZXg

There are three challenges that remain.  When I click on the "Click to Add Service Location" button on the bottom of page 2:

  1. I need to add an instance of "Service_Location_Page" on the following page.  Currently, it is adding it prior to the page I just completed.
  2. I need the value of "Service_Address_Type" on page 2 to change from the default value of "Primary" to "Secondary" on the new instance of "Service_Location_Page" and all subsequent instances.
  3. I need the "Service_Locaton" counter at the top of page 2 to increment by +1 for each new instance of "Service_Location_Page".

Any suggestions for refinements will be greatly appreciated.

Anokie1