Re: Question about optional element in instance

Thanks, John Boyer.

It is the solution for the problem.
I tried another way,

<xforms:bind nodeset="name" relevant="."/>

to avoid additional instance.
But it was not work well, cause once client inputs nothing for name,
forms to input name disappear, then never allows to input again.

As your suggestion, it behaved well by placing another "temp" instance.
Just hopes XForms depends more on XML Schema,
then the form processors worked for these Schema structure limitations.

Thanks for your suggestion, but it sounds more complex form,
because Schema I sent is just a bit of the form,
and I need to place more than 10 thoudsands "temp" instances..
(Now constructing XSL for Schema into XForms)


Any way, thanks a lot.
Miyagi

On Mon, 19 Feb 2007 17:54:34 -0800
John Boyer <boyerj@ca.ibm.com> wrote:

> Hi,
> 
> You would of course have some kind of condition that decides whether or 
> not the name or sex is needed.
> 
> You would use an xforms bind to attach this condition to the relevant 
> model item property of the nodes, like this:
> 
> <xforms:bind nodeset="name" relevant="some condition"/>
> 
> <xforms:bind nodeset="sex" relevant="some other condition"/>
> 
> Note that the conditions you set can be based on data nodes in instance 
> other than your primary data instance that represents a client.
> You can create "temporary variables" in another xforms:instance, and then 
> use their content in your conditions, like this:
> 
> 
> <xforms:instance id="temp" xmlns="">
>    <tempData>
>         <showName>true</showName>
>         <showSex>false</showSex>
>    </tempData>
> </xforms:instance>
> 
> <xforms:bind nodeset="name" relevant="instance('temp')/showName = 'true' 
> "/>
> 
> <xforms:bind nodeset="sex" relevant="instance('temp')/showSex = 'true' "/>
> 
> If the result of the XPath in the 'relevant' attribute is false, then the 
> node(s) indicated by the nodeset attribute is considered to be 
> non-relevant by the XForms processor. 
> 
> XForms submissions remove non-relevant nodes from data before submission.
> 
> Cheers,
> John M. Boyer, Ph.D.
> STSM: Workplace Forms Architect and Researcher
> Co-Chair, W3C Forms Working Group
> Workplace, Portal and Collaboration Software
> IBM Victoria Software Lab
> E-Mail: boyerj@ca.ibm.com  http://www.ibm.com/software/
> 
> Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
> 

Received on Tuesday, 20 February 2007 14:10:04 UTC