exf:relevant doesn't work when used with instance function

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

exf:relevant doesn't work when used with instance function

Adrian Baker
I'm trying to derive the relevancy of a control from another control in a separate instance, and I can't get the exf:relevant function to return correct values when passed a node outside the context instance, ie derived from the instance function:
    exf:relevant(instance('blah')/...)

Nodes relative the context node work fine:
    exf:relevant(../blah)

Attached is an editing version of the controls sample demonstrating the problem: the relevancy of 'age' & 'password' fields are being controlled using radio buttons. Age has it's relevancy derived from a relative exf:relevant expression, secret has it's relevancy derived from an instance() based relevancy expression.



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

bad-exf-relevant.xhtml (29K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: exf:relevant doesn't work when used with instance function

Alessandro  Vernet
Administrator
Hi Adrian,

This seems to be just a typo:

Change: <xforms:bind
nodeset="instance('secret-relevant-mip-target')/relevant"
relevant="instance('instance')/secrect-relevant-boolean = 'true'"/>

To: <xforms:bind nodeset="instance('secret-relevant-mip-target')"
relevant="instance('instance')/secret-relevant-boolean = 'true'"/>

(There is no element 'relevant' in the instance
'secret-relevant-mip-target', and 'secrect' was misspelled.)

After changing this, the secret field hides when selecting the
corresponding radio button. I attached the file with that change for
reference.

Alex

On 1/9/07, Adrian Baker <[hidden email]> wrote:

>
>  I'm trying to derive the relevancy of a control from another control in a
> separate instance, and I can't get the exf:relevant function to return
> correct values when passed a node outside the context instance, ie derived
> from the instance function:
>      exf:relevant(instance('blah')/...)
>
>  Nodes relative the context node work fine:
>      exf:relevant(../blah)
>
>  Attached is an editing version of the controls sample demonstrating the
> problem: the relevancy of 'age' & 'password' fields are being controlled
> using radio buttons. Age has it's relevancy derived from a relative
> exf:relevant expression, secret has it's relevancy derived from an
> instance() based relevancy expression.
>
>
>
> --
> 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
>
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/


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

bad-exf-relevant-mod.xhtml (29K) Download Attachment
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: exf:relevant doesn't work when used with instance function

Adrian Baker
Oops: that example was my (bad) attempt at trying to create a simple example with the problem.

Attached is the original form showing the problem. There is a required input which is hidden inside a group using the value of the boolean. The input's relevancy is derived from the surrounding group's relevancy:

    <xf:bind id="bind-s2PlainTextInput" nodeset="s2PlainTextInput" relevant="exf:relevant(instance('uibind-nodes')/uibind-Section2)" required="true()" />

However trying to save the form with the boolean at 'no', and the required field hidden means it gets rejected. Setting either relevant or required to 'false()' means the Save works.

Maybe I've screwed up something obvious in this one too, but I can't see anything wrong...

Adrian


Alessandro Vernet wrote:
Hi Adrian,

This seems to be just a typo:

Change: <xforms:bind
nodeset="instance('secret-relevant-mip-target')/relevant"
relevant="instance('instance')/secrect-relevant-boolean = 'true'"/>

To: <xforms:bind nodeset="instance('secret-relevant-mip-target')"
relevant="instance('instance')/secret-relevant-boolean = 'true'"/>

(There is no element 'relevant' in the instance
'secret-relevant-mip-target', and 'secrect' was misspelled.)

After changing this, the secret field hides when selecting the
corresponding radio button. I attached the file with that change for
reference.

Alex

On 1/9/07, Adrian Baker [hidden email] wrote:

 I'm trying to derive the relevancy of a control from another control in a
separate instance, and I can't get the exf:relevant function to return
correct values when passed a node outside the context instance, ie derived
from the instance function:
     exf:relevant(instance('blah')/...)

 Nodes relative the context node work fine:
     exf:relevant(../blah)

 Attached is an editing version of the controls sample demonstrating the
problem: the relevancy of 'age' & 'password' fields are being controlled
using radio buttons. Age has it's relevancy derived from a relative
exf:relevant expression, secret has it's relevancy derived from an
instance() based relevancy expression.



--
You receive this message as a subscriber of the [hidden email]
mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
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: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

bad-exf-relevant-complex.xhtml (56K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: exf:relevant doesn't work when used with instance function

Alessandro Vernet
Administrator
Hi Adrian,

I think this comes down to a question of evaluation order. Binds are
evaluated in the order they are specified in your XForms file. In this
case, when you compute the relevancy of s2PlainTextInput, you make a
reference to the relevancy of uibind-Section2 which had not been
evaluated yet.

Move the line with:

<xf:bind id="uibind-Section2"
nodeset="instance('uibind-nodes')/uibind-Section2" orion:uibind="true"
relevant="(instance('instance-document')/s1BooleanInput castable as
xs:boolean and xs:boolean(instance('instance-document')/s1BooleanInput)
eq true())" />

Before the <xf:bind id="wrapping-bind"
nodeset="instance('instance-document')"> and I think things will start
to work as expected. I attached the modified file for reference.

Alex

On 1/11/07, Adrian Baker <[hidden email]> wrote:

>
>  Oops: that example was my (bad) attempt at trying to create a simple
> example with the problem.
>
>  Attached is the original form showing the problem. There is a required
> input which is hidden inside a group using the value of the boolean. The
> input's relevancy is derived from the surrounding group's relevancy:
>
>      <xf:bind id="bind-s2PlainTextInput" nodeset="s2PlainTextInput"
> relevant="exf:relevant(instance('uibind-nodes')/uibind-Section2)"
> required="true()" />
>
>  However trying to save the form with the boolean at 'no', and the required
> field hidden means it gets rejected. Setting either relevant or required to
> 'false()' means the Save works.
>
>  Maybe I've screwed up something obvious in this one too, but I can't see
> anything wrong...
>
>  Adrian
>
>
>  Alessandro Vernet wrote:
> Hi Adrian,
>
>  This seems to be just a typo:
>
>  Change: <xforms:bind
> nodeset="instance('secret-relevant-mip-target')/relevant"
>  relevant="instance('instance')/secrect-relevant-boolean =
> 'true'"/>
>
>  To: <xforms:bind
> nodeset="instance('secret-relevant-mip-target')"
>  relevant="instance('instance')/secret-relevant-boolean =
> 'true'"/>
>
>  (There is no element 'relevant' in the instance
>  'secret-relevant-mip-target', and 'secrect' was misspelled.)
>
>  After changing this, the secret field hides when selecting the
>  corresponding radio button. I attached the file with that change for
>  reference.
>
>  Alex
>
>  On 1/9/07, Adrian Baker <[hidden email]> wrote:
>
>
>   I'm trying to derive the relevancy of a control from another control in a
>  separate instance, and I can't get the exf:relevant function to return
>  correct values when passed a node outside the context instance, ie derived
>  from the instance function:
>       exf:relevant(instance('blah')/...)
>
>   Nodes relative the context node work fine:
>       exf:relevant(../blah)
>
>   Attached is an editing version of the controls sample demonstrating the
>  problem: the relevancy of 'age' & 'password' fields are being controlled
>  using radio buttons. Age has it's relevancy derived from a relative
>  exf:relevant expression, secret has it's relevancy derived from an
>  instance() based relevancy expression.
>
>
>
>  --
>  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
>
>
> --
> 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
>
>
>
>

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

bad-exf-relevant-complex.xhtml (56K) Download Attachment