relevance, dates and live update

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

relevance, dates and live update

Duane Gran-2
Attached is a simple case for the sandbox to illustrate my question.  
I have a date element with a keyDate attribute and I'm using the  
relevance binding so that the display of the input for keyDate only  
shows if there is content on its parent element.  In other words, it  
isn't desirable to have an instance document with the following:

<date keyDate="yes"/>

The problem is that the input field for keyDate doesn't display after  
I've used the date picker control and presumably the date element is  
populated.  Am I misunderstanding the behavior of the relevant bind  
operation?

Duane Gran



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

relevantTest.xml (1012 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: relevance, dates and live update

Erik Bruchez
Administrator
Duane,

When you write:

   <xforms:bind nodeset="/document/date/@keyDate" relevant="../date != ''"/>

"/document/date/@keyDate" points to the "@keyDate" attribute, which
becomes the context in which the "relevant" XPath expression is
executed. If you write "..", you are getting to the parent node of the
"@keyDate" attribute, which is the "date" element. But writing "../date"
would try to look for a "date" child of the other "date" element. So
simply write:

   <xforms:bind nodeset="/document/date/@keyDate" relevant=".. != ''"/>

and it works.

-Erik

Duane Gran wrote:

> Attached is a simple case for the sandbox to illustrate my question.  I
> have a date element with a keyDate attribute and I'm using the relevance
> binding so that the display of the input for keyDate only shows if there
> is content on its parent element.  In other words, it isn't desirable to
> have an instance document with the following:
>
> <date keyDate="yes"/>
>
> The problem is that the input field for keyDate doesn't display after
> I've used the date picker control and presumably the date element is
> populated.  Am I misunderstanding the behavior of the relevant bind
> operation?
>
> Duane Gran
>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <html xmlns="http://www.w3.org/1999/xhtml"
>   xmlns:xforms="http://www.w3.org/2002/xforms"
>   xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <head>
>     <title>relevance test</title>
>     <xforms:model>
>       <xforms:instance>
>         <document xmlns="">
>           <date keyDate=""/>
>         </document>
>       </xforms:instance>
>       <xforms:bind nodeset="/document/date" type="xs:date"/>
>       <xforms:bind nodeset="/document/date/@keyDate" relevant="../date != ''"/>
>     </xforms:model>
>   </head>
>   <body>
>     <p>
>       <xforms:input ref="/document/date">
>         <xforms:label>Date: </xforms:label>
>       </xforms:input>
>     </p>
>     <p>
>       <xforms:select ref="/document/date/@keyDate" appearance="full">
>         <xforms:label>keyDate: </xforms:label>
>         <xforms:item>
>           <xforms:label>yes</xforms:label>
>           <xforms:value>yes</xforms:value>
>         </xforms:item>
>       </xforms:select>
>     </p>
>   </body>
> </html>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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