Use data from xpage on control

hi,

is this possible to have a xpage with control on it, define document on xpage and reference this data from the control?

thanks in advance.

Subject: Yes and there are a number of ways to do this…

One way you could use is with .getComponent() as in…

<xp:inputText id="inputText1"></xp:inputText>

<xp:button value="Submit" id="button1">

	<xp:eventHandler event="onclick" submit="true"

		refreshMode="complete" immediate="false" save="true"></xp:eventHandler>

</xp:button>

<xp:br></xp:br>

<xp:text escape="true" id="computedField2">

	<xp:this.value><![CDATA[#{javascript:getComponent("inputText1").getValue()}]]></xp:this.value>

</xp:text>

Where we can use ‘getComponent(“inputText1”).getValue()’ to get the value of the edit box ‘inputText1’ control.

Is that what you have in mind or is there some other scenario?

Subject: share the same document

I’d like to have number of controls on the same xpage that share the same document. With as small of extra code as possible…

So I’d probably use the same data source on each control but on the xpage I would have only one document shared between those controls.

Thanks in advance for your reply.

Subject: Set the data source on the xpage

You can set a single datasource on the XPage and it is available to all the controls on that XPage. You’ll have to bind those controls to a datasource but you don’t have to redefine the datasource each time.

You can try a simple example by creating an XPage, adding a datasource, then add an input control and bind that control to the datasource and a relevant field.

Also, look at your source code. It’ll explain alot about what’s going on.

Ken

Subject: Save: 4 document created!!! Problem with multiple Datasources? save conflicts documents…

Hello, i’ll try to speak english.I have a main tabbed xpageA with it datasource DS1(create document).

Into xpageA, have included xpageB(tab3) and xpageC(not in a tab).

Into xpageB, have included xpageD.

xpageB with it datasource DS2(create document).

xpageC with it datasource DS3(create document).

xpageD with it datasource DS4(create document).

DS1=DS2=DS3=DS4

Because: I tryed Include xPages as old subforms into forms…

I create a new document.

When i click the save button, positioned into de tab1, i have no problems…

But when i change to tab 3, and click the save button, i get the documento multiplied by 4(3 save conflicts documents)

I think i have a problem with doing datasources.

somebody help me?

Thanks

Diego

Subject: thanks.