These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Table Row addInstance Limit?

gap0134
Registered: Apr 13 2010
Posts: 29

Ok so I found a neat way to dynamically extend the amount of rows offered in a table. Everything works well, I have a footer that counts the rows, sums another column.

Reference:
http://www.adobe.com/devnet/livecycle/articles/AddingRemovingTableRows.pdf

But...when I goto add more than seven rows to the table...nothing happens. Now the coding example I found handles this. My problem is I definitely want more then seven rows. What am I missing?

FYI - I looked at the scripting code for this particular constraint and bumped the count. Nothing effects it.

My Product Information:
LiveCycle Designer, Windows
gap0134
Registered: Apr 13 2010
Posts: 29
Ok so a quick update since there wasn't a response. I recreated the reference I linked with another document:
http://livedocs.adobe.com/livecycle/8.2/acrobat_designer/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Adobe_LiveCycle_Designer_Help&file=000380.phpEverything works and behaves as expected. I do have another question now. I would like to use the xfa.host.setFocus() function focus the user on a dynamically created cell. I tried: xfa.host.setFocus(table1.row1.description);

This partially works, it focuses on the first text field and not the new text field created. So I tried:
xfa.host.setFocus(table1.row1[*].description);

That does not work. Any ideas on how to reference the dynamically created fields?
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

you can use a modified version of Designer's row shading script for this task.
Just put it into the indexChange:event of your table row:

var Freqs=[1,1];var nFreqSize = 0;for (var i=0; i<Freqs.length; i++)nFreqSize += Freqs[i];var nRelIndex = this.index % nFreqSize + 1; for (var nRun=0; nRun<Freqs.length; nRun++){if (nRelIndex > Freqs[nRun]){nRelIndex -= Freqs[nRun];}else{xfa.host.setFocus(this.NameOfCellThatShouldHaveFocus)break;}}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

gap0134
Registered: Apr 13 2010
Posts: 29
Ok I tried that unsuccessfully. I have created a pdf with just the table object and the code. Is there any way to post it to the forum for you to review?

Two things to note. I am already using the row shading script. I pasted the code you provided below the automatically generated code. I also have the buttons that addinstance in a sepearate subform, so I reference the cell object directly. I tested this event in the click of the addinstance button so I know the reference is correct.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
If you already use the script, just add this line

xfa.host.setFocus(this.NameOfCellThatShouldHaveFocus)
to the else expression of the script!

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

gap0134
Registered: Apr 13 2010
Posts: 29
What you are saying is not specific enough. It also does not answer my question on how the script knows what instance to set the focus on. I want the focus to occur on the button click of adding a new instance. Please describe how this will work. Here is the code generated by LiveCycle. If what you are saying works, please show me the line I need to alter or add another line below:


OperationalSpec.Page1.body1FlowD.taskTable.Row1::indexChange - (JavaScript, both)
//{{Adobe LiveCycle Designer Generated Code Begin}} - row shading script. Don't modify it!
var nFreqSize=0
foreach item in (1,1) do
nFreqSize=nFreqSize+item
endfor
var nRelIndex=mod($.index,nFreqSize)+1
var nColorIndex=0
foreach element in (1,1) do
if (nRelIndex>element) then
nRelIndex=nRelIndex-element
nColorIndex=nColorIndex+1
else
break
endif
endfor
var nCount=0
foreach color in ("240,240,240","255,255,255") do
if(nCount==nColorIndex) then
$.border.fill.color.value=color
break
else
nCount=nCount+1
endif
xfa.host.setFocus(taskTable.Row1.description)
endfor
//{{Adobe LiveCycle Designer Generated Code End}} - row shading script.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
I see, that you have another row shading script than I have.
Your script is in FormCalc although the script editor headline indicates it's in JavaScript, courious!
Well, then replace the whole existing script with this one:

OperationalSpec.Page1.body1FlowD.taskTable.Row1::indexChange - (JavaScript, both) //{{Adobe LiveCycle Designer Generated Code Begin}} - row shading script. Ups I modified it!var Freqs=[1,1];var Colors=["240,240,240","255,255,255"];var nFreqSize = 0;for (var i=0; i<Freqs.length; i++)nFreqSize += Freqs[i];var nRelIndex = this.index % nFreqSize + 1;for (var nRun=0; nRun<Freqs.length; nRun++){if (nRelIndex>Freqs[nRun]){nRelIndex -= Freqs[nRun];}else{this.border.fill.color.value = Colors[nRun];xfa.host.setFocus(this.NameOfTheFieldInTheRowThatShouldHaveFocus)break;}}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

gap0134
Registered: Apr 13 2010
Posts: 29
I should have mentioned I tried something similar based on your previous responses. It does not work as expected.

First thing I did was to provide a direct reference instead of using 'this'. When doing so, the shading works fine. But the focus only returns to the first instance of the table NOT the newly added instance. I think the problem lies within my initial question: How can I reference an added instance dynamically in the code? I tried to adjust the focus line to the following:

xfa.host.setFocus(taskTable.Row1[*].description)

I was hoping this would work similar to performing calculation operations. Unfortunately this did not work. Here is the current code:

OperationalSpec.Page1.body1FlowD.taskTable.Row1::indexChange - (JavaScript, both)
//{{Adobe LiveCycle Designer Generated Code Begin}} - row shading script. Oops I modified it!
var Freqs=[1,1];
var Colors=["240,240,240","255,255,255"];
var nFreqSize = 0;
for (var i=0; iFreqs[nRun])
{
nRelIndex -= Freqs[nRun];
}
else
{
this.border.fill.color.value = Colors[nRun];
xfa.host.setFocus(taskTable.Row1.description)
break;
}
}
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
You can't use a reference path like yours.
As the row shading script is located in the row so you only need a reference to the objects that are surrounded by the row (i.e. the cells).

xfa.host.setFocus(this.description);
Example File:
[url]https://acrobat.com/#d=IUgIpS5k1zKKspjTnTg4Dw[/url]

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

gap0134
Registered: Apr 13 2010
Posts: 29
I am not sure how to describe this in a more clear manner: I tried that code line you suggested from your very first response even. It did not work.

The table is wrapped in a flowed subform. The buttons that are adding the instances are in a different column in the table that I am trying to set the dynamic focus to.

I will look at your example and see if I can get it to work.
MarlaZ
Registered: Apr 28 2010
Posts: 112
My dilemma is that when I use my Add Row button, it adds rows but they are added on top of the Content area, blocking the MP footer. They do not move to the next page, along with anything under it.

Why is this happening and how can I make the rows stay within the Content area, move to the next page, and not cover the MP footer?

Thanks!

Marla