问题
Using Livecycle Designer - now Adobe Experience Manager v 6.4.0.xxx, I'm trying to allow my users to create tables within tables in a form. I'm comfortable with non-nested tables - they work fine. The problem is that when I nest tables they lose information over a save. The first row is saved fine, but subsequent rows are not saved.
These are non-trivial tables. An outer row has, say 5 text fields, some radio buttons, subforms that hide/show based on logic, etc. The nested table only shows under certain logic - it also has multiple text fields and check boxes. However, I've simplified this down below - still fails.
Based on Nested tables in livecycle fall apart on email, I decided to toss out tables and nest subforms to gain the same look and feel as tables. Again, one 'table' built this way works fine, but the subsequent nesting breaks - in interesting/crazy ways - the subform nested in row one gets more rows (instanceManager.count) and subsequent rows lose their textfield information - but radio buttons keep their information.
What I've done
- I've rebuilt using subforms over tables. No love, though interesting weirdness.
- I've toggled the Form Properties / run-time / Preserve scripting changes to form when saved -- I want automatic but I've toggled to manual and back. (Per https://forums.adobe.com/thread/1281883)
- I've monitored it as best I can - on preSave and postSave the information is there - on initialization it's gone.
Pre-Save
Post-Save Totally whacky. Kept second row (unlike tables) but lost the information in fields. First row somehow gained another nested row.
I call this from a button 'click'
function fAddSfRow(oSfTable) {
oSfRow = oSfTable.sfRow;
oSfRow.instanceManager.addInstance(1);
}
And, to remove a row - in another button 'click'
var oSfRow = $.parent;
if (oSfRow.instanceManager.count > oSfRow.instanceManager.occur.min ) {
oSfRow.instanceManager.removeInstance(oSfRow.index);
}
Example PDF
What I'd like is a nested table with text fields in each that saves/loads.
Thanks!!
回答1:
Okay, the best answer I've found is...
Wrap only the table with inner tables with a 'pre-save' and 'initialize'.
Presave
- Capture the number of total rows for the outer table
- Capture the number of rows for each inner table
- Capture the rawValue of each field
- Store all this somewhere - say in a hidden text field
Initialize
- Set table.row.instanceManager.count for outer table
- Set table.row.instanceManager.count for each row of inner tables
- Reset all rawValues for fields
- do any logic for hiding/showing subforms or whatever
Ughh.
来源:https://stackoverflow.com/questions/56908923/dynamic-tables-within-tables-do-not-preserve-their-values-over-a-save-load