Patrick Kwinten
Patrick Kwinten

Reputation: 2048

Values from Edit Box controls not saved on Notes Document via SSJS

On an custom control I have data-source bounded to a panel control:

<xp:panel>
<xp:this.data>
    <xp:dominoDocument var="attachDoc" formName="fAttachment"></xp:dominoDocument>
</xp:this.data>
...
</xp:panel>

Within the panel I have some Edit Box controls e.g.

<xp:inputText id="inpOfficial" value="#{attachDoc.migration}">

When I try to save the doc via SSJS the edit boxes are not saved:

function saveAttachment(){
    try {   
        var doc:NotesDocument = attachDoc.getDocument();
        doc.save();
    }
}

What am I missing?

The custom control is repeated over the xpage. The custom control has it's own save button calling the saveAttachment() function

Upvotes: 0

Views: 73

Answers (2)

Stanislaw Guzik
Stanislaw Guzik

Reputation: 244

Andrew Norrie is right. If you still wish to use the back-end NotesDocument, get it like this:

var doc:NotesDocument = attachDoc.getDocument(true);

The parameterized getDocument method will update the back-end NotesDocument with the model values before return.

Upvotes: 0

Andrew Norrie
Andrew Norrie

Reputation: 63

Your saveAttachment() function appears to be trying to save a back end notes document on the database. To pass through the changes in the UI you need to run attachDoc.save() which passes the NotesXSPDocument (UI doc) through to the back end NotesDocument saved to the database.

(Assuming your try statement has a catch but you've left that out)

https://www.ibm.com/support/knowledgecenter/en/SSVRGU_9.0.1/reference/r_wpdr_xsp_xspdocument_r.html

Upvotes: 2

Related Questions