当我从扩展库对话框中保存文档时,某些值为空 [英] When I save a document from an extension library dialog box some values are blank

查看:18
本文介绍了当我从扩展库对话框中保存文档时,某些值为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 8.5.3 UP1

Using 8.5.3 UP1

当我从对话框中保存我的文档时,某些字段没有被填充.如果我从 xpage 中保存文档,它会很好地保存这些字段.下面是一个简单的例子来说明这个问题:

When I save my document from a dialog box certain fields are not being populated. If I save the document from within the xpage it saves these fields just fine. Here is a simple example to illustrate the issue:

    <xp:link text="Save Document By Dialog"
    id="link21">

    <xp:eventHandler event="onclick" submit="false">
        <xp:this.script><![CDATA[XSP.openDialog("#{id:dialog1}");]]></xp:this.script>
    </xp:eventHandler>
</xp:link>
<br/>
<xp:button value="Save By Button" id="button1">
    <xp:eventHandler event="onclick" submit="true"
        refreshMode="complete">
        <xp:this.action>
            <xp:saveDocument var="document1"></xp:saveDocument>
        </xp:this.action>
    </xp:eventHandler>
</xp:button>
<xe:dialog id="dialog1" title="Dialog">
    <br />
    <b>
        <xp:text escape="true" id="computedField1">
            <xp:this.value><![CDATA[#{javascript:"Save this document?"}]]></xp:this.value>
        </xp:text>
    </b>
    <br />
    <br />
    <xp:button value="Yes" id="button7">
        <xp:eventHandler event="onclick" submit="true"
            refreshMode="complete">
            <xp:this.script><![CDATA[XSP.closeDialog("#{id:dialog1}");]]></xp:this.script>
            <xp:this.action>
                <xp:saveDocument var="document1"></xp:saveDocument>
            </xp:this.action></xp:eventHandler>
    </xp:button>        
    <xp:button value="No" id="button8">
        <xp:this.onclick><![CDATA[XSP.closeDialog("#{id:dialog1}");]]></xp:this.onclick>
    </xp:button>
</xe:dialog>
<br/><br/>
<xp:inputText id="TitleTX" value="#{document1.TitleTX}"></xp:inputText>
<br/><br/>
<xp:inputRichText id="inputRichText1" value="#{document1.ProcessMapsRT}">
</xp:inputRichText>

推荐答案

您是否尝试过使用 dataContexts 来定义您的数据源?我相信 dataContext 是一个全局对象.

Have you tried using dataContexts to define your datasource? I believe dataContext is a global object.

更新: dataContexts 甚至 dominoDocument 数据源在保存文档时工作,但问题是值没有保存.因此,我使用了一个 viewScope 变量来存储这些值,这起到了作用.我不确定这是否对您有帮助,但是您可以这样做,这对我有用:

Update: dataContexts or even dominoDocument datasource worked when saving a document, but the problem was that the values were not saved. I therefore used a viewScope variable to store the values and that did the trick. I am not sure if this will help you, but here you go, this works for me:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xe="http://www.ibm.com/xsp/coreex">
    <xp:this.data>
        <xp:dominoDocument var="newDoc" formName="frmContact"></xp:dominoDocument>
    </xp:this.data>
    <xp:inputText id="inputText1" value="#{viewScope.firstName}"></xp:inputText>
    <xp:inputText id="inputText2" value="#{viewScope.lastName}"></xp:inputText>

    <xp:button value="Label" id="button1">
        <xp:eventHandler event="onclick" submit="true"
            refreshMode="partial" refreshId="dialog1">
            <xp:this.action><![CDATA[#{javascript:getComponent("dialog1").show();}]]></xp:this.action>
        </xp:eventHandler>
    </xp:button>

    <xe:dialog id="dialog1">
        <xp:button value="Label" id="button2">
            <xp:eventHandler event="onclick" submit="true"
                refreshMode="complete">
                <xp:this.action><![CDATA[#{javascript:newDoc.replaceItemValue("fldFirstName", viewScope.firstName);
newDoc.replaceItemValue("fldLastName", viewScope.lastName);
newDoc.save(); 
getComponent("dialog1").hide();}]]></xp:this.action>
            </xp:eventHandler>
        </xp:button>
    </xe:dialog>
</xp:view>

希望这有帮助!

这篇关于当我从扩展库对话框中保存文档时,某些值为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆