bind a control to an element's *attribute*?

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

bind a control to an element's *attribute*?

Jean Luc-2
Hello,

Is it possible to bind a control to the *attribute* of an element in the model?

<xf:model>
        <xf:instance xmlns="">
            <foo>
                  <bar attr="something">
            </foo>
        </xf:instance>
[...]
</xf:model>

<body>
    <xf:input ref="bar@code">
        <xf:label>value</xf:label>
    </xf:input>
</body>

The reason for this unusual request is that, ideally, the XML captured via XForm would be as the one used by our application and which, for some fields, uses attributes not elements. I tried <xf:input ref="bar@code"> and <xf:input ref="bar[@code]"> but they don't work.

Is there an elegant solution for the above case? An obvious one is to collect the information in subelements and then, before the final processing for our application, convert certain subelements into attributes. Yet perhaps there is a better way, hence the question. In our case, forms are definable by users, so having fancy event processing would be way too much for them.

Thanks,
JL


--
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: bind a control to an element's *attribute*?

Alexander Žaťko
...try 

<xf:input ref="bar/@attr">...

:-)

A.


On Jan 29, 2008, at 9:14 PM, Jean Luc wrote:

Hello,

Is it possible to bind a control to the *attribute* of an element in the model?

<xf:model>
        <xf:instance xmlns="">

                  <bar attr="something">
            </foo>
        </xf:instance>
[...]
</xf:model>

! <body>
    <xf:input ref="bar@code">
        <xf:label>value</xf:label>
    </xf:input>
</body>

The reason for this unusual request is that, ideally, the XML captured via XForm would be as the one used by our application and which, for some fields, uses attributes not elements. I tried <xf:input ref="bar@code"> and <xf:input ref="bar[@code]"> but they don't work.

Is there an elegant solution for the above case? An obviou! s one is n in subelements and then, before the final processing for our application, convert certain subelements into attributes. Yet perhaps there is a better way, hence the question. In our case, forms are definable by users, so having fancy event processing would be way too much for them.

Thanks,
JL

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
OW2 mailing lists service home page: http://www.ow2.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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: bind a control to an element's *attribute*?

Park, Michael
In reply to this post by Jean Luc-2

JL,

 

Yes. This is a very common thing to do.  Your syntax needs to be changed.  This should clear things up:

 

  1. the attribute name you show is actually ‘attr’
  2. the syntax to reference the attribute should be (you need the slash) <xf:input ref="bar/@attr">

 

 


From: Jean Luc [mailto:[hidden email]]
Sent: Tuesday, January 29, 2008 3:14 PM
To: [hidden email]
Subject: [ops-users] bind a control to an element's *attribute*?

 

Hello,

Is it possible to bind a control to the *attribute* of an element in the model?

<xf:model>
        <xf:instance xmlns="">
            <foo>
                  <bar attr="something">
            </foo>
        </xf:instance>
[...]
</xf:model>

<body>
    <xf:input ref="bar@code">
        <xf:label>value</xf:label>
    </xf:input>
</body>


The reason for this unusual request is that, ideally, the XML captured via XForm would be as the one used by our application and which, for some fields, uses attributes not elements. I tried <xf:input ref="bar@code"> and <xf:input ref="bar[@code]"> but they don't work.

Is there an elegant solution for the above case? An obvious one is to collect the information in subelements and then, before the final processing for our application, convert certain subelements into attributes. Yet perhaps there is a better way, hence the question. In our case, forms are definable by users, so having fancy event processing would be way too much for them.

Thanks,
JL



--
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: bind a control to an element's *attribute*?

Jean Luc-2
Thanks Michael and Alexander, it works fine now with the / (the "code" instead of "attr" was a copy & paste error).
----- Original Message -----
Sent: Tuesday, January 29, 2008 3:56 PM
Subject: RE: [ops-users] bind a control to an element's *attribute*?

JL,

 

Yes. This is a very common thing to do.  Your syntax needs to be changed.  This should clear things up:

 

  1. the attribute name you show is actually ‘attr’
  2. the syntax to reference the attribute should be (you need the slash) <xf:input ref="[hidden email]">

 

 


From: Jean Luc [mailto:[hidden email]]
Sent: Tuesday, January 29, 2008 3:14 PM
To: [hidden email]
Subject: [ops-users] bind a control to an element's *attribute*?

 

Hello,

Is it possible to bind a control to the *attribute* of an element in the model?

<xf:model>
        <xf:instance xmlns="">
            <foo>
                  <bar attr="something">
            </foo>
        </xf:instance>
[...]
</xf:model>

<body>
    <xf:input ref="bar@code">
        <xf:label>value</xf:label>
    </xf:input>
</body>


The reason for this unusual request is that, ideally, the XML captured via XForm would be as the one used by our application and which, for some fields, uses attributes not elements. I tried <xf:input ref="bar@code"> and <xf:input ref="bar[@code]"> but they don't work.

Is there an elegant solution for the above case? An obvious one is to collect the information in subelements and then, before the final processing for our application, convert certain subelements into attributes. Yet perhaps there is a better way, hence the question. In our case, forms are definable by users, so having fancy event processing would be way too much for them.

Thanks,
JL



--
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


--
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