0
votes

With the onclick event of a button I would like to save multiple documents, but only the last one gets saved.

    <xp:this.data>
    <xp:dominoDocument var="document1" formName="tg"></xp:dominoDocument>
    </xp:this.data>

and in the onclick event of the button :

... 
while (re.next()) { 

        document1.replaceItemValue("TGARKD",tgarkd);
        document1.replaceItemValue("TGKDOM",tgkdom);
        document1.replaceItemValue("TGARGR",tgargr);
        document1.replaceItemValue("TGDLGR",tgdlgr);
        document1.save();
}
2

2 Answers

1
votes

If you want to create multiple Documents in the NSF, you'll need to use backend classes. The DominoDocument datasource is tied to a single backend document. var doc = document1.getDocument(true) will get a handle on the (first) backend document, then in your loop use

var doc2 = database.createDocument();
doc.copyAllItems(doc2, true);
doc2.save(true, false);
0
votes

Alternatively you could define your data source inside a repeat control and bind the fields to that one. Then outside the repeat you call save() which saves all data sources