xforms:repeat with xforms:bind??

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

xforms:repeat with xforms:bind??

dsharp
Hello all --
I am having a problem in that I want to use "xf:repeat" but can't get a fresh form.

Please see the simplified code below.

When you hit "add additional product" it links the two products together (because of the "binding," I assume).  I tried using "xf:origin" in the "xf:insert" to insert a clean xml but that won't work.

Does anyone have an idea on how to generate a clean repeat here?

Thanks!
-Darla

product.xml
<product>
<select1value/>
<itemone/>
<itemtwo/>
</product>

<head>
<xf:model>
<xf:instance id="product" src="product.xml"/>


<xf:bind id="itemone" nodeset="/product/itemone" relevant="/product/select1value= 1"/>
<xf:bind id="itemtwo" nodeset="/product/itemtwo" relevant="/product/select1value= 2"/>
</xf:model>
</head>


<body>
<xf:repeat id="repeatproduct" nodeset="/product/select1value">
<xf:select1 ref="/product/select1value">
         <xf:label>Which product do you need</xf:label>
               <xf:item select="yes">
            <xf:label>Item 1</xf:label>
            <xf:value>1</xf:value>
         </xf:item>
         <xf:item>
            <xf:label>Item 2</xf:label>
            <xf:value>2</xf:value>
         </xf:item>          
          </xf:select1>
          
 <xf:input bind="itemone">
 <xf:label>Item one </xf:label>
 </xf:input>
 
 <xf:input bind="itemtwo">
 <xf:label>Item two </xf:label>
 </xf:input>
 </xf:repeat>
 
 <xf:trigger>
 <xf:label>Insert additional product </xf:label>
 <xf:insert ev:event="DOMActivate" nodeset="/product/select1value" at="index('repeatproduct')" position="after"/>
 </xf:trigger>
 
</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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: xforms:repeat with xforms:bind??

Erik Bruchez
Administrator
Darla,

Here is something that should work:

https://gist.github.com/1028670

-Erik

On Tue, Jun 14, 2011 at 12:37 PM, Darla Sharp <[hidden email]> wrote:

> Hello all --
> I am having a problem in that I want to use "xf:repeat" but can't get a
> fresh form.
> Please see the simplified code below.
> When you hit "add additional product" it links the two products together
> (because of the "binding," I assume).  I tried using "xf:origin" in the
> "xf:insert" to insert a clean xml but that won't work.
> Does anyone have an idea on how to generate a clean repeat here?
> Thanks!
> -Darla
> product.xml
> <product>
> <select1value/>
> <itemone/>
> <itemtwo/>
> </product>
> <head>
> <xf:model>
> <xf:instance id="product" src="product.xml"/>
>
> <xf:bind id="itemone" nodeset="/product/itemone"
> relevant="/product/select1value= 1"/>
> <xf:bind id="itemtwo" nodeset="/product/itemtwo"
> relevant="/product/select1value= 2"/>
> </xf:model>
> </head>
>
> <body>
> <xf:repeat id="repeatproduct" nodeset="/product/select1value">
> <xf:select1 ref="/product/select1value">
>          <xf:label>Which product do you need</xf:label>
>                <xf:item select="yes">
>             <xf:label>Item 1</xf:label>
>             <xf:value>1</xf:value>
>          </xf:item>
>          <xf:item>
>             <xf:label>Item 2</xf:label>
>             <xf:value>2</xf:value>
>          </xf:item>
>           </xf:select1>
>
>  <xf:input bind="itemone">
>  <xf:label>Item one </xf:label>
>  </xf:input>
>
>  <xf:input bind="itemtwo">
>  <xf:label>Item two </xf:label>
>  </xf:input>
>  </xf:repeat>
>
>  <xf:trigger>
>  <xf:label>Insert additional product </xf:label>
>  <xf:insert ev:event="DOMActivate" nodeset="/product/select1value"
> at="index('repeatproduct')" position="after"/>
>  </xf:trigger>
>
> </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
> 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: xforms:repeat with xforms:bind??

dsharp
Hi Erik,
Thanks for the reply!

I tried the code you suggested and it created a fresh repeat (which is great!), but it didn't allow for relevancy in that both xf:input "Item One" and xf:input "Item Two" show up regardless of what the value of select1value is. 

Also, is there that when the user chooses "Item 2" for the first form and then repeats the product that the next select1 doesn't default to "Item 2"?

Thoughts?

Thanks in advance!!
Darla


On Wed, Jun 15, 2011 at 9:27 PM, Erik Bruchez <[hidden email]> wrote:
Darla,

Here is something that should work:

https://gist.github.com/1028670

-Erik

On Tue, Jun 14, 2011 at 12:37 PM, Darla Sharp <[hidden email]> wrote:
> Hello all --
> I am having a problem in that I want to use "xf:repeat" but can't get a
> fresh form.
> Please see the simplified code below.
> When you hit "add additional product" it links the two products together
> (because of the "binding," I assume).  I tried using "xf:origin" in the
> "xf:insert" to insert a clean xml but that won't work.
> Does anyone have an idea on how to generate a clean repeat here?
> Thanks!
> -Darla
> product.xml
> <product>
> <select1value/>
> <itemone/>
> <itemtwo/>
> </product>
> <head>
> <xf:model>
> <xf:instance id="product" src="product.xml"/>
>
> <xf:bind id="itemone" nodeset="/product/itemone"
> relevant="/product/select1value= 1"/>
> <xf:bind id="itemtwo" nodeset="/product/itemtwo"
> relevant="/product/select1value= 2"/>
> </xf:model>
> </head>
>
> <body>
> <xf:repeat id="repeatproduct" nodeset="/product/select1value">
> <xf:select1 ref="/product/select1value">
>          <xf:label>Which product do you need</xf:label>
>                <xf:item select="yes">
>             <xf:label>Item 1</xf:label>
>             <xf:value>1</xf:value>
>          </xf:item>
>          <xf:item>
>             <xf:label>Item 2</xf:label>
>             <xf:value>2</xf:value>
>          </xf:item>
>           </xf:select1>
>
>  <xf:input bind="itemone">
>  <xf:label>Item one </xf:label>
>  </xf:input>
>
>  <xf:input bind="itemtwo">
>  <xf:label>Item two </xf:label>
>  </xf:input>
>  </xf:repeat>
>
>  <xf:trigger>
>  <xf:label>Insert additional product </xf:label>
>  <xf:insert ev:event="DOMActivate" nodeset="/product/select1value"
> at="index('repeatproduct')" position="after"/>
>  </xf:trigger>
>
> </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
> 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




--
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: xforms:repeat with xforms:bind??

Erik Bruchez
Administrator
Darla,

That's not what I see when I run this example: in the new row,
relevance works for me. Did you just paste this example? Is this with
3.9?

-Erik

On Sun, Jun 19, 2011 at 11:23 AM, Darla Sharp <[hidden email]> wrote:

> Hi Erik,
> Thanks for the reply!
> I tried the code you suggested and it created a fresh repeat (which is
> great!), but it didn't allow for relevancy in that both xf:input "Item One"
> and xf:input "Item Two" show up regardless of what the value of select1value
> is.
> Also, is there that when the user chooses "Item 2" for the first form and
> then repeats the product that the next select1 doesn't default to "Item 2"?
> Thoughts?
> Thanks in advance!!
> Darla
>
> On Wed, Jun 15, 2011 at 9:27 PM, Erik Bruchez <[hidden email]> wrote:
>>
>> Darla,
>>
>> Here is something that should work:
>>
>> https://gist.github.com/1028670
>>
>> -Erik
>>
>> On Tue, Jun 14, 2011 at 12:37 PM, Darla Sharp <[hidden email]>
>> wrote:
>> > Hello all --
>> > I am having a problem in that I want to use "xf:repeat" but can't get a
>> > fresh form.
>> > Please see the simplified code below.
>> > When you hit "add additional product" it links the two products together
>> > (because of the "binding," I assume).  I tried using "xf:origin" in the
>> > "xf:insert" to insert a clean xml but that won't work.
>> > Does anyone have an idea on how to generate a clean repeat here?
>> > Thanks!
>> > -Darla
>> > product.xml
>> > <product>
>> > <select1value/>
>> > <itemone/>
>> > <itemtwo/>
>> > </product>
>> > <head>
>> > <xf:model>
>> > <xf:instance id="product" src="product.xml"/>
>> >
>> > <xf:bind id="itemone" nodeset="/product/itemone"
>> > relevant="/product/select1value= 1"/>
>> > <xf:bind id="itemtwo" nodeset="/product/itemtwo"
>> > relevant="/product/select1value= 2"/>
>> > </xf:model>
>> > </head>
>> >
>> > <body>
>> > <xf:repeat id="repeatproduct" nodeset="/product/select1value">
>> > <xf:select1 ref="/product/select1value">
>> >          <xf:label>Which product do you need</xf:label>
>> >                <xf:item select="yes">
>> >             <xf:label>Item 1</xf:label>
>> >             <xf:value>1</xf:value>
>> >          </xf:item>
>> >          <xf:item>
>> >             <xf:label>Item 2</xf:label>
>> >             <xf:value>2</xf:value>
>> >          </xf:item>
>> >           </xf:select1>
>> >
>> >  <xf:input bind="itemone">
>> >  <xf:label>Item one </xf:label>
>> >  </xf:input>
>> >
>> >  <xf:input bind="itemtwo">
>> >  <xf:label>Item two </xf:label>
>> >  </xf:input>
>> >  </xf:repeat>
>> >
>> >  <xf:trigger>
>> >  <xf:label>Insert additional product </xf:label>
>> >  <xf:insert ev:event="DOMActivate" nodeset="/product/select1value"
>> > at="index('repeatproduct')" position="after"/>
>> >  </xf:trigger>
>> >
>> > </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
>> > 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
>>
>
>
>
> --
> 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: Re: xforms:repeat with xforms:bind??

dsharp
Hi Erik,

Everything looked good until I ran it in the web browser and then it didn't work as I needed.

For closure, the following code worked.  Thanks for your help!!
-Darla

<html xmlns="http://www.w3.org/1999/xhtml"

      xmlns:xf="http://www.w3.org/2002/xforms"

      xmlns:xxf="http://orbeon.org/oxf/xml/xforms"

      xmlns:ev="http://www.w3.org/2001/xml-events"

      xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <head>

        <xf:model>

            <xf:instance id="product" xmlns="">

                <products>

                    <product>

                        <select1value/>

                        <itemone/>

                        <itemtwo/>

                    </product>

                </products>

            </xf:instance>

           

            <xf:instance id="init" xmlns="">

                <products>

                    <product>

                        <select1value/>

                        <itemone/>

                        <itemtwo/>

                    </product>

                </products>

            </xf:instance>

           

            <xf:bind nodeset="product">

                <xf:bind id="itemone" nodeset="itemone" relevant="../select1value = '1'"/>

                <xf:bind id="itemtwo" nodeset="itemtwo" relevant="../select1value = '2'"/>

            </xf:bind>

                <xf:submission id="submit_model_auctionItems"  ref="instance('product')"

           method="post"

           action="http://www.sharpformatting.com/xforms_mail.php" />

        </xf:model>

    </head>

    <body>

        <xf:repeat id="repeatproduct" nodeset="product">

            <xf:select1 ref="select1value">

                <xf:label>Which product do you need</xf:label>

                <xf:item>

                    <xf:label>Item 1</xf:label>

                    <xf:value>1</xf:value>

                </xf:item>

                <xf:item>

                    <xf:label>Item 2</xf:label>

                    <xf:value>2</xf:value>

                </xf:item>

            </xf:select1>

 

            <xf:input ref="itemone">

                <xf:label>Item one</xf:label>

            </xf:input>

 

            <xf:input ref="itemtwo">

                <xf:label>Item two</xf:label>

            </xf:input>

        </xf:repeat>

 

        <xf:trigger>

            <xf:label>Insert additional product</xf:label>

            <xf:insert ev:event="DOMActivate" nodeset="product" at="index('repeatproduct')" position="after" origin="instance('init')/product"/>

        </xf:trigger>

     

    <xf:submit submission="submit_model_auctionItems" >

      <xf:label>Submit</xf:label>

    </xf:submit>

    </body>

</html>


On Mon, Jun 20, 2011 at 10:57 PM, Erik Bruchez <[hidden email]> wrote:
Darla,

That's not what I see when I run this example: in the new row,
relevance works for me. Did you just paste this example? Is this with
3.9?

-Erik

On Sun, Jun 19, 2011 at 11:23 AM, Darla Sharp <[hidden email]> wrote:
> Hi Erik,
> Thanks for the reply!
> I tried the code you suggested and it created a fresh repeat (which is
> great!), but it didn't allow for relevancy in that both xf:input "Item One"
> and xf:input "Item Two" show up regardless of what the value of select1value
> is.
> Also, is there that when the user chooses "Item 2" for the first form and
> then repeats the product that the next select1 doesn't default to "Item 2"?
> Thoughts?
> Thanks in advance!!
> Darla
>
> On Wed, Jun 15, 2011 at 9:27 PM, Erik Bruchez <[hidden email]> wrote:
>>
>> Darla,
>>
>> Here is something that should work:
>>
>> https://gist.github.com/1028670
>>
>> -Erik
>>
>> On Tue, Jun 14, 2011 at 12:37 PM, Darla Sharp <[hidden email]>
>> wrote:
>> > Hello all --
>> > I am having a problem in that I want to use "xf:repeat" but can't get a
>> > fresh form.
>> > Please see the simplified code below.
>> > When you hit "add additional product" it links the two products together
>> > (because of the "binding," I assume).  I tried using "xf:origin" in the
>> > "xf:insert" to insert a clean xml but that won't work.
>> > Does anyone have an idea on how to generate a clean repeat here?
>> > Thanks!
>> > -Darla
>> > product.xml
>> > <product>
>> > <select1value/>
>> > <itemone/>
>> > <itemtwo/>
>> > </product>
>> > <head>
>> > <xf:model>
>> > <xf:instance id="product" src="product.xml"/>
>> >
>> > <xf:bind id="itemone" nodeset="/product/itemone"
>> > relevant="/product/select1value= 1"/>
>> > <xf:bind id="itemtwo" nodeset="/product/itemtwo"
>> > relevant="/product/select1value= 2"/>
>> > </xf:model>
>> > </head>
>> >
>> > <body>
>> > <xf:repeat id="repeatproduct" nodeset="/product/select1value">
>> > <xf:select1 ref="/product/select1value">
>> >          <xf:label>Which product do you need</xf:label>
>> >                <xf:item select="yes">
>> >             <xf:label>Item 1</xf:label>
>> >             <xf:value>1</xf:value>
>> >          </xf:item>
>> >          <xf:item>
>> >             <xf:label>Item 2</xf:label>
>> >             <xf:value>2</xf:value>
>> >          </xf:item>
>> >           </xf:select1>
>> >
>> >  <xf:input bind="itemone">
>> >  <xf:label>Item one </xf:label>
>> >  </xf:input>
>> >
>> >  <xf:input bind="itemtwo">
>> >  <xf:label>Item two </xf:label>
>> >  </xf:input>
>> >  </xf:repeat>
>> >
>> >  <xf:trigger>
>> >  <xf:label>Insert additional product </xf:label>
>> >  <xf:insert ev:event="DOMActivate" nodeset="/product/select1value"
>> > at="index('repeatproduct')" position="after"/>
>> >  </xf:trigger>
>> >
>> > </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
>> > 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
>>
>
>
>
> --
> 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




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