Reference to current input?

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

Reference to current input?

Mike Ahlers
Hi,

Maybe I am doing something the hard way, but upon entering a value in an input, I also want to update a different instance with the same value. Now, my problem is, that I cannot reference the current entered value...

This is what I tried:

<xforms:input ref="@id">
    <xforms:label>ISO Code</xforms:label>
    <xforms:action ev:event="xforms-value-changed">
        <xforms:setvalue ref="instance('status-model')/country-id" value=" ??? "/>
    </xforms:action>
</xforms:input>

When I hardcode the value to something like 'test' I do see it changed...

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Re ference to current input?

Hank Ratzesberger

Hi Mike,

Because the ref= attribute of setvalue specifies an xpath binding
that applies to the value= attribute.

Your value= attribute needs to specify the instance:

So, you need to specify the instance in your value attribute

value="instance('orig-input-inst')/@id"

You can also setvalue between any instance and any other instance
by using instance() in both the ref and value attributes.

HTH,
Hank

On May 12, 2008, at 8:24 AM, Mike Ahlers wrote:

>
> Hi,
>
> Maybe I am doing something the hard way, but upon entering a value  
> in an
> input, I also want to update a different instance with the same  
> value. Now,
> my problem is, that I cannot reference the current entered value...
>
> This is what I tried:
>
> <xforms:input ref="@id">
>     <xforms:label>ISO Code</xforms:label>
>     <xforms:action ev:event="xforms-value-changed">
>         <xforms:setvalue ref="instance('status-model')/country-id"  
> value="
> ??? "/>
>     </xforms:action>
> </xforms:input>
>
> When I hardcode the value to something like 'test' I do see it  
> changed...
>
> Thanks
> --
> View this message in context: http://www.nabble.com/Reference-to- 
> current-input--tp17189798p17189798.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.com.
>
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re ference to current input?

Mike Ahlers

Hank Ratzesberger wrote
Hi Mike,

Because the ref= attribute of setvalue specifies an xpath binding
that applies to the value= attribute.

Your value= attribute needs to specify the instance:

So, you need to specify the instance in your value attribute

value="instance('orig-input-inst')/@id"

You can also setvalue between any instance and any other instance
by using instance() in both the ref and value attributes.

HTH,
Hank
Hi Hank,

That did the trick. Thanks. What I previously did was: instance('other-model')/<root-node>/@id

Instead of what you suggested. The root-node isn't needed, I realize that now.

- Mike
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re ference to current input?

Erik Bruchez
Administrator
>>

>> Because the ref= attribute of setvalue specifies an xpath binding
>> that applies to the value= attribute.
>>
>> Your value= attribute needs to specify the instance:
>>
>> So, you need to specify the instance in your value attribute
>>
>> value="instance('orig-input-inst')/@id"
>>
>> You can also setvalue between any instance and any other instance
>> by using instance() in both the ref and value attributes.
>>
>> HTH,
>> Hank
>>
>>
>
> Hi Hank,
>
> That did the trick. Thanks. What I previously did was:
> instance('other-model')/<root-node>/@id
>
> Instead of what you suggested. The root-node isn't needed, I realize  
> that
> now.
With relatively recent builds, you could also write:

<xforms:setvalue ref="instance('status-model')/country-id"  
value="context()"/>

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws