trigger to repeat element not working

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

trigger to repeat element not working

Robert Walpole
Hi,

Can anyone tell me why the trigger to repeat the address element doesn't
work in this XForm? The same code works ok in another XForms processor.

<?xml version="1.0" encoding="UTF-8"?>
<html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:my="http://my.namespace.org">
    <head>
        <title>Community Directory - Creator Form</title>
       
        <xforms:model
schema="/apps/communitydirectory-creator/schema.xsd">
       
            <xforms:instance id="communitygroup-instance">
                <communitygroup xmlns="">
                    <group>
                        <name/>
                        <purpose/>
                        <address/>
                        <town/>
                        <county/>
                        <postcode/>
                        <number type=""/>
                        <email/>
                        <website/>
                    </group>
                </communitygroup>
            </xforms:instance>
           
            <xforms:bind id="group" nodeset="/communitygroup/group">
                <xforms:bind id="group_name" nodeset="name"
required="true()"/>
                <xforms:bind id="group_purpose" nodeset="purpose"
required="true()"/>
                <xforms:bind id="repeat_group_address"
nodeset="address">
                    <xforms:bind id="group_address" nodeset="."/>
                </xforms:bind>
                <xforms:bind id="group_town" nodeset="town"/>
                <xforms:bind id="group_county" nodeset="county"/>
                <xforms:bind id="group_postcode" nodeset="postcode"/>
                <xforms:bind id="group_number" nodeset="number"/>
                <xforms:bind id="group_number_type"
nodeset="number/@type"/>
                <xforms:bind id="group_email" nodeset="email"/>
                <xforms:bind id="group_website" nodeset="website"/>
            </xforms:bind>
           
            <xforms:instance id="numbertypes-instance">
                <numbertypes xmlns="">
                    <numbertype>
                        <name>Office</name>
                        <value>Office</value>
                    </numbertype>
                    <numbertype>
                        <name>Answerphone</name>
                        <value>Answerphone</value>
                    </numbertype>
                    <numbertype>
                        <name>Fax</name>
                        <value>Fax</value>
                    </numbertype>
                </numbertypes>
            </xforms:instance>
           
            <xforms:submission id="save-submission"
ref="instance('communitygroup-instance')"
action="/exist/rest/db/orbeon/communitydirectory-creator/communitygroup1
.xml" method="put" replace="none"/>
       
        </xforms:model>
   
    </head>
    <body>
   
        <!-- this group relates to the communitygroup/group node within
the communitydirectory schema -->
        <xforms:group bind="group">
           
            <xforms:input bind="group_name">
                <xforms:label>Name:</xforms:label>
            </xforms:input>
            <br/>
 
            <xforms:textarea bind="group_purpose">
                <xforms:label>Purpose:</xforms:label>
            </xforms:textarea>
            <br/>
           
            <xforms:trigger>
                <xforms:label>Add address line</xforms:label>
                <!-- xforms:hint>appends a new entry at the end of this
collection</xforms:hint -->
                <xforms:action>
                    <xforms:insert ev:event="DOMActivate"
context="instance('communitygroup-instance')"
bind="repeat_group_address" at="index('repeat-address')"
position="after"/>
                </xforms:action>
            </xforms:trigger>
            <br/>
           
            <!--xforms:trigger>
                <xforms:label>Delete address line</xforms:label>
                <xforms:hint>deletes selected entry from this
collection</xforms:hint>
                <xforms:action>
                    <xforms:delete bind="repeat_group_address"
at="index('repeat-address')"/>
                </xforms:action>
            </xforms:trigger -->
           
            <xforms:repeat id="repeat-address"
bind="repeat_group_address">
                <xforms:input bind="group_address">
                    <xforms:label>Address:</xforms:label>
                </xforms:input>
                <br/>
            </xforms:repeat>
           
            <xforms:input bind="group_town">
                <xforms:label>Town:</xforms:label>
            </xforms:input>
            <br/>
           
            <xforms:input bind="group_county">
                <xforms:label>County:</xforms:label>
            </xforms:input>
            <br/>
           
            <xforms:input bind="group_postcode">
                <xforms:label>Postcode:</xforms:label>
            </xforms:input>
            <br/>
           
            <xforms:select1 bind="group_number_type">
                <xforms:label>Type:</xforms:label>
                <xforms:item>
                    <xforms:label>Choose One...</xforms:label>
                    <xforms:value/>
                </xforms:item>
                <xforms:itemset
nodeset="instance('numbertypes-instance')/numbertype">
                    <xforms:label ref="name"/>
                    <xforms:value ref="value"/>
                </xforms:itemset>                
            </xforms:select1>
            <xforms:input bind="group_number">
                <xforms:label>Number:</xforms:label>
            </xforms:input>
            <br/>
           
            <xforms:input bind="group_email">
                <xforms:label>Email:</xforms:label>
            </xforms:input>
            <br/>
           
            <xforms:input bind="group_website">
                <xforms:label>Website:</xforms:label>
            </xforms:input>
            <br/>
           
        </xforms:group>
       
        <xforms:submit submission="save-submission">
            <xforms:label>Save</xforms:label>
        </xforms:submit>

    </body>
</html>

Thanks
Rob Walpole
Devon Portal Developer
Email [hidden email]
Web http://www.devonline.gov.uk




--
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
Reply | Threaded
Open this post in threaded view
|

Re: trigger to repeat element not working

Alessandro Vernet
Administrator
Hi Robert,

This is because in the trigger you have:

<xforms:action>
    <xforms:insert ev:event="DOMActivate"
context="instance('communitygroup-instance')"
            bind="repeat_group_address" at="index('repeat-address')"
position="after"/>
</xforms:action>

You should either not have an <xforms:action> or the
ev:event="DOMActivate" should be on the <xforms:action> itself.
Otherwise this action just won't run.

Alex

On 4/20/07, Robert Walpole <[hidden email]> wrote:

> Hi,
>
> Can anyone tell me why the trigger to repeat the address element doesn't
> work in this XForm? The same code works ok in another XForms processor.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <html
>     xmlns="http://www.w3.org/1999/xhtml"
>     xmlns:xforms="http://www.w3.org/2002/xforms"
>     xmlns:ev="http://www.w3.org/2001/xml-events"
>     xmlns:xs="http://www.w3.org/2001/XMLSchema"
>     xmlns:my="http://my.namespace.org">
>     <head>
>         <title>Community Directory - Creator Form</title>
>
>         <xforms:model
> schema="/apps/communitydirectory-creator/schema.xsd">
>
>             <xforms:instance id="communitygroup-instance">
>                 <communitygroup xmlns="">
>                     <group>
>                         <name/>
>                         <purpose/>
>                         <address/>
>                         <town/>
>                         <county/>
>                         <postcode/>
>                         <number type=""/>
>                         <email/>
>                         <website/>
>                     </group>
>                 </communitygroup>
>             </xforms:instance>
>
>             <xforms:bind id="group" nodeset="/communitygroup/group">
>                 <xforms:bind id="group_name" nodeset="name"
> required="true()"/>
>                 <xforms:bind id="group_purpose" nodeset="purpose"
> required="true()"/>
>                 <xforms:bind id="repeat_group_address"
> nodeset="address">
>                     <xforms:bind id="group_address" nodeset="."/>
>                 </xforms:bind>
>                 <xforms:bind id="group_town" nodeset="town"/>
>                 <xforms:bind id="group_county" nodeset="county"/>
>                 <xforms:bind id="group_postcode" nodeset="postcode"/>
>                 <xforms:bind id="group_number" nodeset="number"/>
>                 <xforms:bind id="group_number_type"
> nodeset="number/@type"/>
>                 <xforms:bind id="group_email" nodeset="email"/>
>                 <xforms:bind id="group_website" nodeset="website"/>
>             </xforms:bind>
>
>             <xforms:instance id="numbertypes-instance">
>                 <numbertypes xmlns="">
>                     <numbertype>
>                         <name>Office</name>
>                         <value>Office</value>
>                     </numbertype>
>                     <numbertype>
>                         <name>Answerphone</name>
>                         <value>Answerphone</value>
>                     </numbertype>
>                     <numbertype>
>                         <name>Fax</name>
>                         <value>Fax</value>
>                     </numbertype>
>                 </numbertypes>
>             </xforms:instance>
>
>             <xforms:submission id="save-submission"
> ref="instance('communitygroup-instance')"
> action="/exist/rest/db/orbeon/communitydirectory-creator/communitygroup1
> .xml" method="put" replace="none"/>
>
>         </xforms:model>
>
>     </head>
>     <body>
>
>         <!-- this group relates to the communitygroup/group node within
> the communitydirectory schema -->
>         <xforms:group bind="group">
>
>             <xforms:input bind="group_name">
>                 <xforms:label>Name:</xforms:label>
>             </xforms:input>
>             <br/>
>
>             <xforms:textarea bind="group_purpose">
>                 <xforms:label>Purpose:</xforms:label>
>             </xforms:textarea>
>             <br/>
>
>             <xforms:trigger>
>                 <xforms:label>Add address line</xforms:label>
>                 <!-- xforms:hint>appends a new entry at the end of this
> collection</xforms:hint -->
>                 <xforms:action>
>                     <xforms:insert ev:event="DOMActivate"
> context="instance('communitygroup-instance')"
> bind="repeat_group_address" at="index('repeat-address')"
> position="after"/>
>                 </xforms:action>
>             </xforms:trigger>
>             <br/>
>
>             <!--xforms:trigger>
>                 <xforms:label>Delete address line</xforms:label>
>                 <xforms:hint>deletes selected entry from this
> collection</xforms:hint>
>                 <xforms:action>
>                     <xforms:delete bind="repeat_group_address"
> at="index('repeat-address')"/>
>                 </xforms:action>
>             </xforms:trigger -->
>
>             <xforms:repeat id="repeat-address"
> bind="repeat_group_address">
>                 <xforms:input bind="group_address">
>                     <xforms:label>Address:</xforms:label>
>                 </xforms:input>
>                 <br/>
>             </xforms:repeat>
>
>             <xforms:input bind="group_town">
>                 <xforms:label>Town:</xforms:label>
>             </xforms:input>
>             <br/>
>
>             <xforms:input bind="group_county">
>                 <xforms:label>County:</xforms:label>
>             </xforms:input>
>             <br/>
>
>             <xforms:input bind="group_postcode">
>                 <xforms:label>Postcode:</xforms:label>
>             </xforms:input>
>             <br/>
>
>             <xforms:select1 bind="group_number_type">
>                 <xforms:label>Type:</xforms:label>
>                 <xforms:item>
>                     <xforms:label>Choose One...</xforms:label>
>                     <xforms:value/>
>                 </xforms:item>
>                 <xforms:itemset
> nodeset="instance('numbertypes-instance')/numbertype">
>                     <xforms:label ref="name"/>
>                     <xforms:value ref="value"/>
>                 </xforms:itemset>
>             </xforms:select1>
>             <xforms:input bind="group_number">
>                 <xforms:label>Number:</xforms:label>
>             </xforms:input>
>             <br/>
>
>             <xforms:input bind="group_email">
>                 <xforms:label>Email:</xforms:label>
>             </xforms:input>
>             <br/>
>
>             <xforms:input bind="group_website">
>                 <xforms:label>Website:</xforms:label>
>             </xforms:input>
>             <br/>
>
>         </xforms:group>
>
>         <xforms:submit submission="save-submission">
>             <xforms:label>Save</xforms:label>
>         </xforms:submit>
>
>     </body>
> </html>
>
> Thanks
> Rob Walpole
> Devon Portal Developer
> Email [hidden email]
> Web http://www.devonline.gov.uk
>
>
>
>
> --
> 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
>
>

--
Orbeon Forms - Web 2.0 Forms for the Enterprise
http://www.orbeon.com/



--
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
Reply | Threaded
Open this post in threaded view
|

RE: trigger to repeat element not working

Robert Walpole
In reply to this post by Robert Walpole
Ah, thanks Alex, that makes sense - and it works great. Now I don't
recall what inspired me to put that xforms:action in there at all - just
getting a bit carried away I guess ;-)

Thanks again
Rob Walpole
Devon Portal Developer
Email [hidden email]
Web http://www.devonline.gov.uk


> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Alessandro Vernet
> Sent: 21 April 2007 00:36
> To: [hidden email]
> Subject: Re: [ops-users] trigger to repeat element not working
>
>
> Hi Robert,
>
> This is because in the trigger you have:
>
> <xforms:action>
>     <xforms:insert ev:event="DOMActivate"
> context="instance('communitygroup-instance')"
>             bind="repeat_group_address" at="index('repeat-address')"
> position="after"/>
> </xforms:action>
>
> You should either not have an <xforms:action> or the
> ev:event="DOMActivate" should be on the <xforms:action> itself.
> Otherwise this action just won't run.
>
> Alex
>
> On 4/20/07, Robert Walpole <[hidden email]> wrote:
> > Hi,
> >
> > Can anyone tell me why the trigger to repeat the address
> element doesn't
> > work in this XForm? The same code works ok in another
> XForms processor.
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <html
> >     xmlns="http://www.w3.org/1999/xhtml"
> >     xmlns:xforms="http://www.w3.org/2002/xforms"
> >     xmlns:ev="http://www.w3.org/2001/xml-events"
> >     xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >     xmlns:my="http://my.namespace.org">
> >     <head>
> >         <title>Community Directory - Creator Form</title>
> >
> >         <xforms:model
> > schema="/apps/communitydirectory-creator/schema.xsd">
> >
> >             <xforms:instance id="communitygroup-instance">
> >                 <communitygroup xmlns="">
> >                     <group>
> >                         <name/>
> >                         <purpose/>
> >                         <address/>
> >                         <town/>
> >                         <county/>
> >                         <postcode/>
> >                         <number type=""/>
> >                         <email/>
> >                         <website/>
> >                     </group>
> >                 </communitygroup>
> >             </xforms:instance>
> >
> >             <xforms:bind id="group" nodeset="/communitygroup/group">
> >                 <xforms:bind id="group_name" nodeset="name"
> > required="true()"/>
> >                 <xforms:bind id="group_purpose" nodeset="purpose"
> > required="true()"/>
> >                 <xforms:bind id="repeat_group_address"
> > nodeset="address">
> >                     <xforms:bind id="group_address" nodeset="."/>
> >                 </xforms:bind>
> >                 <xforms:bind id="group_town" nodeset="town"/>
> >                 <xforms:bind id="group_county" nodeset="county"/>
> >                 <xforms:bind id="group_postcode"
> nodeset="postcode"/>
> >                 <xforms:bind id="group_number" nodeset="number"/>
> >                 <xforms:bind id="group_number_type"
> > nodeset="number/@type"/>
> >                 <xforms:bind id="group_email" nodeset="email"/>
> >                 <xforms:bind id="group_website" nodeset="website"/>
> >             </xforms:bind>
> >
> >             <xforms:instance id="numbertypes-instance">
> >                 <numbertypes xmlns="">
> >                     <numbertype>
> >                         <name>Office</name>
> >                         <value>Office</value>
> >                     </numbertype>
> >                     <numbertype>
> >                         <name>Answerphone</name>
> >                         <value>Answerphone</value>
> >                     </numbertype>
> >                     <numbertype>
> >                         <name>Fax</name>
> >                         <value>Fax</value>
> >                     </numbertype>
> >                 </numbertypes>
> >             </xforms:instance>
> >
> >             <xforms:submission id="save-submission"
> > ref="instance('communitygroup-instance')"
> >
> action="/exist/rest/db/orbeon/communitydirectory-creator/commu
> nitygroup1
> > .xml" method="put" replace="none"/>
> >
> >         </xforms:model>
> >
> >     </head>
> >     <body>
> >
> >         <!-- this group relates to the communitygroup/group
> node within
> > the communitydirectory schema -->
> >         <xforms:group bind="group">
> >
> >             <xforms:input bind="group_name">
> >                 <xforms:label>Name:</xforms:label>
> >             </xforms:input>
> >             <br/>
> >
> >             <xforms:textarea bind="group_purpose">
> >                 <xforms:label>Purpose:</xforms:label>
> >             </xforms:textarea>
> >             <br/>
> >
> >             <xforms:trigger>
> >                 <xforms:label>Add address line</xforms:label>
> >                 <!-- xforms:hint>appends a new entry at the
> end of this
> > collection</xforms:hint -->
> >                 <xforms:action>
> >                     <xforms:insert ev:event="DOMActivate"
> > context="instance('communitygroup-instance')"
> > bind="repeat_group_address" at="index('repeat-address')"
> > position="after"/>
> >                 </xforms:action>
> >             </xforms:trigger>
> >             <br/>
> >
> >             <!--xforms:trigger>
> >                 <xforms:label>Delete address line</xforms:label>
> >                 <xforms:hint>deletes selected entry from this
> > collection</xforms:hint>
> >                 <xforms:action>
> >                     <xforms:delete bind="repeat_group_address"
> > at="index('repeat-address')"/>
> >                 </xforms:action>
> >             </xforms:trigger -->
> >
> >             <xforms:repeat id="repeat-address"
> > bind="repeat_group_address">
> >                 <xforms:input bind="group_address">
> >                     <xforms:label>Address:</xforms:label>
> >                 </xforms:input>
> >                 <br/>
> >             </xforms:repeat>
> >
> >             <xforms:input bind="group_town">
> >                 <xforms:label>Town:</xforms:label>
> >             </xforms:input>
> >             <br/>
> >
> >             <xforms:input bind="group_county">
> >                 <xforms:label>County:</xforms:label>
> >             </xforms:input>
> >             <br/>
> >
> >             <xforms:input bind="group_postcode">
> >                 <xforms:label>Postcode:</xforms:label>
> >             </xforms:input>
> >             <br/>
> >
> >             <xforms:select1 bind="group_number_type">
> >                 <xforms:label>Type:</xforms:label>
> >                 <xforms:item>
> >                     <xforms:label>Choose One...</xforms:label>
> >                     <xforms:value/>
> >                 </xforms:item>
> >                 <xforms:itemset
> > nodeset="instance('numbertypes-instance')/numbertype">
> >                     <xforms:label ref="name"/>
> >                     <xforms:value ref="value"/>
> >                 </xforms:itemset>
> >             </xforms:select1>
> >             <xforms:input bind="group_number">
> >                 <xforms:label>Number:</xforms:label>
> >             </xforms:input>
> >             <br/>
> >
> >             <xforms:input bind="group_email">
> >                 <xforms:label>Email:</xforms:label>
> >             </xforms:input>
> >             <br/>
> >
> >             <xforms:input bind="group_website">
> >                 <xforms:label>Website:</xforms:label>
> >             </xforms:input>
> >             <br/>
> >
> >         </xforms:group>
> >
> >         <xforms:submit submission="save-submission">
> >             <xforms:label>Save</xforms:label>
> >         </xforms:submit>
> >
> >     </body>
> > </html>
> >
> > Thanks
> > Rob Walpole
> > Devon Portal Developer
> > Email [hidden email]
> > Web http://www.devonline.gov.uk
> >
> >
> >
> >
> > --
> > 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
> >
> >
>
>
> --
> Orbeon Forms - Web 2.0
> Forms for the Enterprise
> http://www.orbeon.com/
>
>


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