RE: "required" question

> From: Kia Dabirian 
> 
> Let me try again. Hopefully this is more valid :).

Now, I understand your question.
 
> <!-- stuff -->
> 
> <model xmlns="...Xforms" id="f1">
>   <instance xmlns="">
>     <data>
>       <!-- other stuff -->
>       <userdata>
>         <username/>
>         <password/>
>         <domain/>
>       </userdata>
>     <data/>
>   </instance>
>   <bind id="bindL" ref="//userdata" required="not(//userid)"/>
>   <bind id="bindL" ref="//username" required="true()"/>
>   <bind id="bindP" ref="//password" required="true()"/>
>   <bind id="bindD" ref="//domain"/>
>   <submitInfo action="doit.exe" method="post" id="s"/>
> </model>
> 
> <!-- other stuff -->
> 
> <group xmlns="...Xforms" id="l" bind="bindL">
>   <caption>User Login</caption>
>   <input id="u" bind="bindU">
>     <caption>username</caption>
>   </input>
>   <secret id="p" bind="bindP">
>     <caption>password</caption>
>   </secret>
>   <input id="d" bind="bindD">
>     <caption>domain</caption>
>   </input>
>   <submit submitInfo="s">
>     <caption>Login</caption>
>   </submit>
> </group>
> 
> <!-- other stuff -->
> 
> And if it is, will the resulting domain field be required? 

AFAIK, the answer is "Yes," because the instance data is structured in a
hierarchical manner to enforce that. The required constraint on userdata
applies to domain because domain is a child of userdata, and userid does
not exist. Most constraints, including required, do apply to children of
the selected instance data.   

> And If so, how do I make it not required?
> 
> The question can be boiled down to:
> 
>   Is a field "F" required when
>     Required(F) and 
>     Required(Parent(F)) and 
>     Required(Parent(Parent(F))) and
>     ...
> 
>   or when
>   
>     Required(F) or 
>     Required(Parent(F)) or
>     Required(Parent(Parent(F))) or
>     ...

If you do want to get into situations where things involve UI controls,
then take a look at binding attribute "6.1.4 relevant." There is a nice
table that describes how it interacts with the required constraint and
UI. Where the spec says "Applies to children: Yes," it means children of
the bound instance data, not children of UI container elements such as
group. In particular, notice the combination required=true() and
relevant=false(). If model item is not currently relevant, then the
model item constraint required does not apply.

So, change the first bind to:

<bind id="bindL" ref="//userdata" relevant="not(//userid)"/>

Now, domain is not required beause userdata is not required. But since
userdata is relevant, the "User Login" group becomes active and username
and password are required. 

+-DRD-+

Received on Friday, 16 August 2002 10:45:15 UTC