How to bind two nodes to one control?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to bind two nodes to one control?

Jacques-Alexandre Gerber
Hi,

I have another question about Xforms binding. I have an xforms:input
control that I would like to bind to one xforms instance node to display
the default value, but I would like to bind it to a different node when
submitting the form.

For example, let's say I have these xforms:instance declaratons:

<forms:model>
 <xforms:instance id="input">
  <input>
   <value>default value</value>
  </input>
 </xforms:instance>
 <xforms:instance id="output">
  <output>
   <value/>
  </output>
 </xforms:instance>
</xforms:model>

So I would like to have an input control that shows the value from
/input/value by default and when I submit the form I would like the
entered value (which may be the default or may be changed by the user)
to be in /output/value.

If I do <xforms:input ref="instance('input')/value"/>, I see the default
value in my form, but /output/value will never contain anything.
If I do <xforms:output ref="instance('output')/value"/>, I get the value
entered by the user in /output/value, but the default value does not
display.

Basically I want to bind the initial value of /output/value to
/input/value.

How do I do this?

JAG



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: How to bind two nodes to one control?

Erik Bruchez
Administrator
JAG,

You can't bind a control to two nodes, but you can make it so that upon
value change of that control, you explicitly set the value into the
second instance, i.e.:

<xforms:input ref="instance('input')/value">
   <xforms:setvalue ev:event="xforms-value-changed"
     ref="instance('output')/value" value="instance('input')/value"/>
</xforms:input>

-Erik

Jacques-Alexandre Gerber wrote:

> Hi,
>
> I have another question about Xforms binding. I have an xforms:input
> control that I would like to bind to one xforms instance node to display
> the default value, but I would like to bind it to a different node when
> submitting the form.
>
> For example, let's say I have these xforms:instance declaratons:
>
> <forms:model>
>  <xforms:instance id="input">
>   <input>
>    <value>default value</value>
>   </input>
>  </xforms:instance>
>  <xforms:instance id="output">
>   <output>
>    <value/>
>   </output>
>  </xforms:instance>
> </xforms:model>
>
> So I would like to have an input control that shows the value from
> /input/value by default and when I submit the form I would like the
> entered value (which may be the default or may be changed by the user)
> to be in /output/value.
>
> If I do <xforms:input ref="instance('input')/value"/>, I see the default
> value in my form, but /output/value will never contain anything.
> If I do <xforms:output ref="instance('output')/value"/>, I get the value
> entered by the user in /output/value, but the default value does not
> display.
>
> Basically I want to bind the initial value of /output/value to
> /input/value.
>
> How do I do this?
>
> JAG
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: How to bind two nodes to one control?

Jacques-Alexandre Gerber
In reply to this post by Jacques-Alexandre Gerber
Erik,

I did try this indeeed, but if my input instance has no initial value
(it's coming as the result of a pipeline), then the control does not
show up at all, so the user can't provide any value!

JAG

-----Original Message-----
From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez
Sent: Friday, December 16, 2005 9:33 PM
To: [hidden email]
Subject: Re: [ops-users] How to bind two nodes to one control?

JAG,

You can't bind a control to two nodes, but you can make it so that upon
value change of that control, you explicitly set the value into the
second instance, i.e.:

<xforms:input ref="instance('input')/value">
   <xforms:setvalue ev:event="xforms-value-changed"
     ref="instance('output')/value" value="instance('input')/value"/>
</xforms:input>

-Erik

Jacques-Alexandre Gerber wrote:

> Hi,
>
> I have another question about Xforms binding. I have an xforms:input
> control that I would like to bind to one xforms instance node to
> display the default value, but I would like to bind it to a different
> node when submitting the form.
>
> For example, let's say I have these xforms:instance declaratons:
>
> <forms:model>
>  <xforms:instance id="input">
>   <input>
>    <value>default value</value>
>   </input>
>  </xforms:instance>
>  <xforms:instance id="output">
>   <output>
>    <value/>
>   </output>
>  </xforms:instance>
> </xforms:model>
>
> So I would like to have an input control that shows the value from
> /input/value by default and when I submit the form I would like the
> entered value (which may be the default or may be changed by the user)

> to be in /output/value.
>
> If I do <xforms:input ref="instance('input')/value"/>, I see the
> default value in my form, but /output/value will never contain
anything.
> If I do <xforms:output ref="instance('output')/value"/>, I get the
> value entered by the user in /output/value, but the default value does

> not display.
>
> Basically I want to bind the initial value of /output/value to
> /input/value.
>
> How do I do this?
>
> JAG
>
>
>
> ----------------------------------------------------------------------
> --
>
>
> --
> You receive this message as a subscriber of the
[hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page:
> http://www.objectweb.org/wws





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: How to bind two nodes to one control?

Erik Bruchez
Administrator
If the element containing the value is missing, the control won't
show-up. However if just the value is missing, the control should
definitely show-up! In other words:

<xforms:instance id="input">
   <input>
     <value/>
   </input>
</xforms:instance>

<xforms:input ref="instance('input')/value"/>

will work.

-Erik

Jacques-Alexandre Gerber wrote:

> Erik,
>
> I did try this indeeed, but if my input instance has no initial value
> (it's coming as the result of a pipeline), then the control does not
> show up at all, so the user can't provide any value!
>
> JAG
>
> -----Original Message-----
> From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez
> Sent: Friday, December 16, 2005 9:33 PM
> To: [hidden email]
> Subject: Re: [ops-users] How to bind two nodes to one control?
>
> JAG,
>
> You can't bind a control to two nodes, but you can make it so that upon
> value change of that control, you explicitly set the value into the
> second instance, i.e.:
>
> <xforms:input ref="instance('input')/value">
>    <xforms:setvalue ev:event="xforms-value-changed"
>      ref="instance('output')/value" value="instance('input')/value"/>
> </xforms:input>
>
> -Erik
>
> Jacques-Alexandre Gerber wrote:
>
>>Hi,
>>
>>I have another question about Xforms binding. I have an xforms:input
>>control that I would like to bind to one xforms instance node to
>>display the default value, but I would like to bind it to a different
>>node when submitting the form.
>>
>>For example, let's say I have these xforms:instance declaratons:
>>
>><forms:model>
>> <xforms:instance id="input">
>>  <input>
>>   <value>default value</value>
>>  </input>
>> </xforms:instance>
>> <xforms:instance id="output">
>>  <output>
>>   <value/>
>>  </output>
>> </xforms:instance>
>></xforms:model>
>>
>>So I would like to have an input control that shows the value from
>>/input/value by default and when I submit the form I would like the
>>entered value (which may be the default or may be changed by the user)
>
>
>>to be in /output/value.
>>
>>If I do <xforms:input ref="instance('input')/value"/>, I see the
>>default value in my form, but /output/value will never contain
>
> anything.
>
>>If I do <xforms:output ref="instance('output')/value"/>, I get the
>>value entered by the user in /output/value, but the default value does
>
>
>>not display.
>>
>>Basically I want to bind the initial value of /output/value to
>>/input/value.
>>
>>How do I do this?
>>
>>JAG


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: How to bind two nodes to one control?

Jacques-Alexandre Gerber
In reply to this post by Jacques-Alexandre Gerber
True. I guess I just have to make sure I always get this element.

Thanks,

JAG

-----Original Message-----
From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez
Sent: Friday, December 16, 2005 10:58 PM
To: [hidden email]
Subject: Re: [ops-users] How to bind two nodes to one control?

If the element containing the value is missing, the control won't
show-up. However if just the value is missing, the control should
definitely show-up! In other words:

<xforms:instance id="input">
   <input>
     <value/>
   </input>
</xforms:instance>

<xforms:input ref="instance('input')/value"/>

will work.

-Erik

Jacques-Alexandre Gerber wrote:

> Erik,
>
> I did try this indeeed, but if my input instance has no initial value
> (it's coming as the result of a pipeline), then the control does not
> show up at all, so the user can't provide any value!
>
> JAG
>
> -----Original Message-----
> From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik
> Bruchez
> Sent: Friday, December 16, 2005 9:33 PM
> To: [hidden email]
> Subject: Re: [ops-users] How to bind two nodes to one control?
>
> JAG,
>
> You can't bind a control to two nodes, but you can make it so that
> upon value change of that control, you explicitly set the value into
> the second instance, i.e.:
>
> <xforms:input ref="instance('input')/value">
>    <xforms:setvalue ev:event="xforms-value-changed"
>      ref="instance('output')/value" value="instance('input')/value"/>
> </xforms:input>
>
> -Erik
>
> Jacques-Alexandre Gerber wrote:
>
>>Hi,
>>
>>I have another question about Xforms binding. I have an xforms:input
>>control that I would like to bind to one xforms instance node to
>>display the default value, but I would like to bind it to a different
>>node when submitting the form.
>>
>>For example, let's say I have these xforms:instance declaratons:
>>
>><forms:model>
>> <xforms:instance id="input">
>>  <input>
>>   <value>default value</value>
>>  </input>
>> </xforms:instance>
>> <xforms:instance id="output">
>>  <output>
>>   <value/>
>>  </output>
>> </xforms:instance>
>></xforms:model>
>>
>>So I would like to have an input control that shows the value from
>>/input/value by default and when I submit the form I would like the
>>entered value (which may be the default or may be changed by the user)
>
>
>>to be in /output/value.
>>
>>If I do <xforms:input ref="instance('input')/value"/>, I see the
>>default value in my form, but /output/value will never contain
>
> anything.
>
>>If I do <xforms:output ref="instance('output')/value"/>, I get the
>>value entered by the user in /output/value, but the default value does
>
>
>>not display.
>>
>>Basically I want to bind the initial value of /output/value to
>>/input/value.
>>
>>How do I do this?
>>
>>JAG



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws