xpages 为什么我的字段值没有被正确复制
我前段时间添加了这个问题 xpages 将 UNID 传递到其他字段 ... 目前看来它奏效了.
I add some time ago this question xpages passing the UNID to other field ... and for the moment it seems it worked.
在创建 <xe:dialog>
结构(使用单个数据源:Pdoc
)后,我发现无法获得正确的 其他数据源的 UNID
:Cdoc
.这个对话框是从具有数据源 Cdoc.
After I created the <xe:dialog>
structure ( which uses a single datasource: Pdoc
), I observed I can't get the correct UNID
of the other datasource: Cdoc
. This dialog is showed from the xpages having the datasource Cdoc.
在主 Xpage(作为数据源:Cdoc
)上有一个计算字段:(txt_UNID
位于具有公式 @text(@uniquedocumentid) )
On the main Xpage ( which has as the datasource: Cdoc
) there is a computed field: ( txt_UNID
is on a form having the formula @text(@uniquedocumentid) )
<xp:text escape="true" id="computedField3" value="#{Cdoc.txt_UNID}"></xp:text>
和一个显示对话框的按钮:
and a button which shows the dialog:
<xp:button value="Adding a Pdoc structure inside my dialog" id="button3"
styleClass="lotusFormButton" refreshMode="partial" rendered="#{javascript:currentDocument.isEditable()}">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="computedField3">
<xp:this.action><![CDATA[#{javascript: if ( Cdoc.isNewNote() ) { Cdoc.save();
Cdoc.setValue("computedField3",Cdoc.getDocument().getUniversalID());
getComponent('exampleDialog').show() }
else
{
Cdoc.setValue("computedField3",Cdoc.getDocument().getUniversalID());
getComponent('exampleDialog').show()}
}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
对话框将 refreshOnShow
设置为 true
.在对话框内,有一个字段(绑定到 Pdoc
源),我想在其中显示存储在我的主 XPage 的前一个计算字段中的 Cdoc
的 UNID:
The dialog is having the refreshOnShow
set to true
. Inside the dialog, there is a field ( binded to the Pdoc
source ) where I want to display the UNID of Cdoc
stored in the previous computed field from my main XPage:
<xp:inputText value="#{Pdoc.txt_CompanieUNID}"
id="inputText1" defaultValue="#{Cdoc.txt_UNID}">
</xp:inputText>
我认为问题出在这里......而不是 #{Cdoc.txt_UNID}
,我确实尝试添加 getComponent("computedField3").getValue()
作为上面 inputText
的默认值,但我得到一个错误,考虑到这个事实,我想 computedField3
不在对话框内?我做错了什么?
I think the problem is here ... Instead of #{Cdoc.txt_UNID}
, I did tried adding getComponent("computedField3").getValue()
as the default value for my above inputText
, but I get an error, considering the fact, I suppose, the computedField3
isn't inside the dialog ?
What am I doing wrong?
顺便说一句,对话框包含许多具有默认值的字段(绑定到 Pdoc ):
Btw, the dialog contains numerous fields ( binded to Pdoc ) having the default value:
Cdoc.<field_name>
它工作正常.我不知道为什么在 computedField3/txt_UNID
的情况下它不起作用.感谢您的时间!
and it works OK. I don't know why in the case of the computedField3/txt_UNID
it doesn't work.
Thanks for your time!
您混淆了字段名称和组件名称.在显示对话框的按钮中执行此操作,以使用预期值更新字段 txt_UNID:
You are mixing up field name and component name. Do this in your button that shows the dialog to update the field txt_UNID with the expected value:
Cdoc.setValue("txt_UNID", Cdoc.getDocument().getUniversalID());