【问题标题】:Save Document via XPage DataSource and computeWithForm="onsave"通过 XPage DataSource 和 computeWithForm="onsave" 保存文档
【发布时间】:2018-04-27 00:17:59
【问题描述】:

当我使用 computeWithForm="onsave" 在 XPage 中保存 Notes 文档时,表单上没有计算任何内容。

我以为 computeWithForm 选项会触发表单中的“QuerySave”事件,但我错了吗?

我知道我可以在 Xpage 数据源中使用 querySaveDocument 事件,但是有很多 lotusscript 逻辑:-)

表格:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE form SYSTEM 'xmlschemas/domino_9_0_1.dtd'>
<form name='testform' xmlns='http://www.lotus.com/dxl' version='9.0' maintenanceversion='1.9'
 replicaid='C125827800263D1B' noquery='true' publicaccess='false' designerversion='8.5.3'
 recalc='true' renderpassthrough='true'>

<code event='querysave'><lotusscript
>Sub Querysave(Source As Notesuidocument, Continue As Variant)

    Dim doc As NotesDocument
    Set doc = Source.Document
    doc.test = "123"
    Call doc.Save( True, False )

End Sub</lotusscript></code>
<body><richtext>
<pardef id='1' leftmargin='1in' hide='notes web' tabs='L6.9375in'/>
<par def='1'/>
<pardef id='2'/>
<par def='2'><run><font name='Verdana' pitch='variable' truetype='true' familyid='20'/><field
 usenotesstyle='false' height='0.2500in' width='4.7243in' multiline='true'
 borderstyle='single' type='text' kind='editable' name='title'/></run></par>
<par def='2'><field type='text' kind='editable' name='test'/><compositedata
 type='98' prevtype='65418' nexttype='222' afterparcount='6' containertype='65418'
 aftercontainercount='1' afterbegincount='3'>
Yg4BAIQAAAAAAAAAAAA=
</compositedata></par></richtext></body>
<item name='$$ScriptName' summary='false' sign='true'><text>testform</text></item></form>

Xpage:

    <?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
    <xp:this.data>
        <xp:dominoDocument var="document1" formName="testform" computeWithForm="onsave"  />
    </xp:this.data>

<xp:inputText value="#{document1.titel}" id="titel1" />

<xp:br></xp:br>

<xp:button value="save" id="button1">
    <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
        <xp:this.action>
            <xp:saveDocument var="document1" />
        </xp:this.action>
    </xp:eventHandler>
</xp:button>
</xp:view>

【问题讨论】:

    标签: xpages lotus-notes xpages-ssjs


    【解决方案1】:

    computeWithForm 仅运行输入转换和输入验证公式。

    如果您想保留 LS 逻辑,一种选择是将其移动到代理(我相信您需要将 UIDocument 类更改为 Document 类并相应地重新编码)并从 XPages 调用代理。不过这不是我做过的事情,所以我无法将您指向文档。

    【讨论】:

    • 它实际上也运行默认值 - 如果该项目丢失并且(但我需要验证)表单标题(可能有副作用)
    【解决方案2】:

    这是个误会! 用表单计算 执行关联表单中的@Formula。它不执行任何表单事件或运行 LotusScript。如果您想使用 LotusScript,您需要将其拉入一个代理并显式调用该代理(提示:不要打扰,将您的脚本转换为 SSJS 或 Java)。

    除此之外:您不应该在 querySave 事件中调用 doc.save - 无论如何都会有保存操作。您敲击了两次磁盘(这是针对 Notes 客户端应用程序的,如上所述,代码不在 XPages 中运行)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-30
      • 1970-01-01
      • 2019-06-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多