Can I use <widget:tabs> for <xs:choice> from schema

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

Can I use <widget:tabs> for <xs:choice> from schema

masjab-2
Hey, 

I have the following problem:

My OrbeonFormApp is for creating an "dictionaryEntry".
This entry can be a single-word or a phrase.
If it´s a single word the user must give a "root" to that word and if it´s a phrase an "optional-root" can be given.
Now in my form I used
<widget:tabs>

so that the user can choose if he wants to create a singleEntry or a phrase. But this is not good because it seems to be connected with AND and what I need is OR.
My initData is also not good because it loads both, the nodes for a singleEntry and for a phrase...
I do know what is wrong but I don´t know a workaround.

I think I need something like:
if (user chose "singleWord" in the widget ){
load initDataForSingleWord}
else
{
load initDataForPhrase
}


Can someone help me please with this?


My schema looks like that:

<xs:complexType name="lemma">
        <xs:choice>
            <xs:element name="word" type="word"/>
            <xs:element name="phrase" type="phrase"/>
        </xs:choice>
    </xs:complexType>

    

    <xs:complexType name="word">
        <xs:sequence>
            <xs:element name="graph" minOccurs="1" maxOccurs="1" type="xs:string"/>
            <!-- hier noch einen datentypen fŸr wurzeln wŠr ganz nett... -->
            <xs:element name="root" minOccurs="1" maxOccurs="1" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>

    

    <xs:complexType name="phrase">
        <xs:sequence>
            <xs:element name="words" minOccurs="1" maxOccurs="1" type="xs:string"/>
            <!-- hier die frage ob man zu einem hauptwort ne wurzel abspeichern will ... -->
            <xs:element name="rootToImportantWordOfPhrase" minOccurs="0" maxOccurs="1" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>




--
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: Can I use <widget:tabs> for <xs:choice> from schema

masjab-2
Hey all, 

is there any chance to get a choice between dataOutput

1)
<root>
<a>
<b/>
</a>
</root>

or
 
2)
<root>
<a>
<c/>
</a>
</root>

in one form?

My schema does handle it with "choice" but I don´t know how to make my form choose one of the possibilities...

THX


--
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: Can I use <widget:tabs> for <xs:choice> from schema

fl.schmitt(ops-users)
hi Masen,

> My schema does handle it with "choice" but I don´t know how to make my
> form choose one of the possibilities...

I#m not sure wether this mathes your needs, but you could use xforms:group to
display different controls depending on a certain condition:

<xforms:group ref=".[<condition1>]">
     first group of controls
</xforms:group>

<xforms:group ref=".[<condition2>]">
     second group of controls
</xforms:group>

condition1 and condition2 can be a xpath expression, so the two groups can be
toggled depending on the existence of a certain node or on a certain value of a
node.

HTH
florian


--
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: Re: Can I use <widget:tabs> for <xs:choice> from schema

masjab-2
Hey Florian,

I thought about it but still there is the problem that I load my data  
from an initEntries.xml...

If I have a structure like this:

<root>
      <a>
        <b/> | <c/>                    <-----this one should depend on what  
the user chose...
     </a>
      <sameToAll/>
</root>

can I do it like:

<model id="1">
<instance id="sameToAll">
        <root>
      <a>
                       
      </a>
      <sameToAll/>
        </root>
</instance>
<instance id="2">
<root2>
        <b/> | <c/>                    <-----this one should depend on what  
the user chose...
</root2>


after all copy /root2/* to /root/a/
I know this pseudocode sounds funny, but is there anything like that?

THX




Am 18.06.2008 um 07:47 schrieb Florian Schmitt:

> hi Masen,
>
>> My schema does handle it with "choice" but I don´t know how to make  
>> my form choose one of the possibilities...
>
> I#m not sure wether this mathes your needs, but you could use  
> xforms:group to display different controls depending on a certain  
> condition:
>
> <xforms:group ref=".[<condition1>]">
>    first group of controls
> </xforms:group>
>
> <xforms:group ref=".[<condition2>]">
>    second group of controls
> </xforms:group>
>
> condition1 and condition2 can be a xpath expression, so the two  
> groups can be toggled depending on the existence of a certain node  
> or on a certain value of a node.
>
> HTH
> florian
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Can I use <widget:tabs> for <xs:choice> from schema

masjab-2
Hello, 

ok, I changed my whole data and it´s almost ok now. 

But I need something like a "conditional bind" .
Is there anything like that?

It´s because I have 2cases:

i) user chooses "singleWordCreation"
Then two fields ( lemma & root   ) have to be filled out

ii) user chooses "PhraseCreation"
Then only one field ( lemma  ) has to be filled out

The problem is that I had to take out the requirement for the root out of my schema...
In my form I had:
<xforms:bind nodeset="root" required="true()"/>

but I want to change it because it leeds to a submission-error in case ii)...

Does anyone know if I can use an xpathExpression in the required attribute...
something like:

required="[if-expression-true-then-root-is-required]"...

THX !!!!!!=)



--
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: Re: Re: Re: Can I use <widget:tabs> for <xs:choice> from schema

masjab-2
Hey, got it..=)

 <xforms:bind nodeset="root"
                    relevant="instance('entries-instance')/entry/@singleWordOrPhrase='sw'"
                    required="true()"/>

THX anyway!


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