0
votes

I add some time ago this question xpages passing the UNID to other field ... and for the moment it seems it worked.

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.

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>

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>

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?

Btw, the dialog contains numerous fields ( binded to Pdoc ) having the default value:

Cdoc.<field_name> 

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!

1

1 Answers

0
votes

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());