My form has one dynamically repeating row by the user clicking a button. I have it set to a maximum of 8 rows. Some form users only need one row while others need more than one. When I export the forms using Arcobat X, any form with more than one row exports the other row data to the very far right column in Excel. This makes reviewing the data difficult with one row in a column in the middle of the spreadsheet and the rest a full page width to the right. Is there anyway I can keep these together regardless of how many rows are dynamically created (up to the max number allowed)?
Should I hide the table rows instead of creatin them dynamically? If yes, how do I make one at a time visible with a button?
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
The "rowObj[*]" field was just an example. You needed to replace it with the name of your rows. So based on your example form, the code would be:
rowNodes = xfa.resolveNodes("form1.#subform[0].Action.Table1.MoreActions[*]");
for (var rowCount = 0; rowCount < rowNodes.length; rowCount++) {
// if this row is hidden, then show it and exit the loop
if (rowNodes.item(rowCount).presence === "hidden") {
rowNodes.item(rowCount).presence = "visible";
break;
}
}
Make sure you get that last closing bracket too, I missed it in the first chunk of code I posted.
Another problem in the form is that you have "Repeat Row for Each Data Item" checked in the binding tab. Remove this for all rows. The rows are there all the time (although they may be hidden), their presence is not driven by the data so this is not needed.
Also, your remove row buttons script will need a change from:
_MoreActions.removeInstance(this.parent.index);
to:
this.parent.presence = "hidden";
Views
Replies
Total Likes
Since you know that you never want more than 8 rows, you could show/hide the rows rather than create them to ensure consistent data.
To show a row, you will need to check each row to find the first hidden row and make it visible. Code might be something like this:
rowNodes = xfa.resolveNodes("rowObj[*]");
for (var rowCount = 0; rowCount < rowNodes.length; rowCount++) {
// if this row is hidden, then show it and exit the loop
if (rowNodes.item(rowCount).presence === "hidden") {
rowNodes.item(rowCount).presence = "visible";
break;
}
To remove a row, you will do a similar thing in reverse, i.e. loop through from the end until you find a visible row. Before hiding it though, you will need to clear any data that was entered.
Views
Replies
Total Likes
I can't get the script above to work.
I created 9 identical rows and set them to hidden (exclude from layout). The subform is set to flowed and I copied the script and added it to the click event of the button. What am I doing wrong?
Views
Replies
Total Likes
Here's a link to the form example...
Views
Replies
Total Likes
The "rowObj[*]" field was just an example. You needed to replace it with the name of your rows. So based on your example form, the code would be:
rowNodes = xfa.resolveNodes("form1.#subform[0].Action.Table1.MoreActions[*]");
for (var rowCount = 0; rowCount < rowNodes.length; rowCount++) {
// if this row is hidden, then show it and exit the loop
if (rowNodes.item(rowCount).presence === "hidden") {
rowNodes.item(rowCount).presence = "visible";
break;
}
}
Make sure you get that last closing bracket too, I missed it in the first chunk of code I posted.
Another problem in the form is that you have "Repeat Row for Each Data Item" checked in the binding tab. Remove this for all rows. The rows are there all the time (although they may be hidden), their presence is not driven by the data so this is not needed.
Also, your remove row buttons script will need a change from:
_MoreActions.removeInstance(this.parent.index);
to:
this.parent.presence = "hidden";
Views
Replies
Total Likes
Now I understand - works great!
Thank you so much!
~Don
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies