Xpages 保存新文档时,xspdocument显示为空

Xpages 保存新文档时,xspdocument显示为空,xpages,Xpages,这是很难解释的,所以我很感谢你通过阅读这篇文章 我有一个带有三个标签的xPages应用程序。每个选项卡都有自己的自定义控件。在第一个自定义控件上,我有以下代码: <xp:this.data> <xp:dominoDocument var="vendorApplication" formName="frmVendorApplication" action="editDocument" computeWithForm="onsave"> <xp:this.documen

这是很难解释的,所以我很感谢你通过阅读这篇文章

我有一个带有三个标签的xPages应用程序。每个选项卡都有自己的自定义控件。在第一个自定义控件上,我有以下代码:

<xp:this.data>
<xp:dominoDocument var="vendorApplication" formName="frmVendorApplication"
action="editDocument" computeWithForm="onsave">
<xp:this.documentId><![CDATA[#{javascript:( param.vendorAppNoteID || "");}]]>
</xp:this.documentId>
</xp:dominoDocument>
</xp:this.data>
我遇到的问题是,当我试图保存一个新文档时,我会一直保存到vendorAppDocument.save(),然后我会得到一个关于它为null的错误。如果我正在编辑一个现有的文档,那就可以了


我怀疑这与作为新文档时未设置vendorApplication(XSPDocument)有关。如何将vendorApplication设置为当前XSP文档?或者您是否看到缺少的其他内容?

请确保使用getDocument(true)将后端文档与前端文档中所做的更改同步。以下各点也是如此:

vendorApplication.save();
var vendorAppDocument = vendorApplication.getDocument(true);
//  a bunch of code that does vendorAppDocument.ReplaceItemValues( ..... )
vendorAppDocument.save();

原来问题很简单,只需删除action=“editDocument”



出于好奇,为什么要在“后端”文档上调用
replaceItemValue
,而不是在保存之前将所有项目写入
vendorApplication
?我想我必须使用后端向表单上不存在的字段添加值。No。数据源的
formName
属性中指定的表单甚至不需要存在。链接到现有表单设计元素主要是为了方便(允许设计器提供链接组件的字段列表、数据类型的强制执行等)。但您可以将组件绑定到表单上未定义的字段,将数据源绑定到不存在的表单
dataSource.setValue(“arbitraryField”,someValue)
将创建指定项,无论该字段是否已定义,或者是否存在表单设计元素。
vendorApplication.save();
var vendorAppDocument = vendorApplication.getDocument(true);
//  a bunch of code that does vendorAppDocument.ReplaceItemValues( ..... )
vendorAppDocument.save();
<xp:this.data>
<xp:dominoDocument var="vendorApplication" formName="frmVendorApplication"
action="editDocument" computeWithForm="onsave">