Repeating Sections (almost working)

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

Repeating Sections (almost working)

Dustin Henson-2
I'm having trouble creating a repeating section in a form. I have the <xforms:repeat> section working with a <xforms:trigger> that adds new records. However, all the records seem to link to the same set of XML tags so that when I add a value to one it is echoed in the other instances. I have checked the resulting XML and Orbeon is adding an additional xml sections for each new instance I see on the screen.

This is what the bind looked like before I added the repeating section. Leaving this unchanged also works, but the data in all the instances are linked as above.
<xforms:bind id="SI_PIIdentifierBind"
             type="xforms:string"
             nodeset="instance('default-instance')/IncidentInvolvedIdentityActivity/InvolvedIdentity/PIIdentifier"
             required="(instance('config-instance')/IncidentInvolvedIdentityActivity/InvolvedIdentity/PIIdentifier = 1)" />


From the online examples I gathered that I had to change the nodeset to a relative path. This is what it looks like now.
<xforms:bind id="SI_PIIdentifierBind"
             type="xforms:string"
             nodeset="InvolvedIdentity/PIIdentifier"
             required="(instance('config-instance')/IncidentInvolvedIdentityActivity/InvolvedIdentity/PIIdentifier = 1)" />

This is what the form section looks like. Note that aside from adding the <xhtml:repeat> I did NOT change anything in this area.
<xhtml:table>
    <xforms:repeat nodeset="instance('default-instance')/IncidentInvolvedIdentityActivity[position() &lt; last()]">
        <xhtml:tr>
            <xhtml:td class="form-td">
                <br/>
                <b>Form of Identification #<xforms:output value="position()"/></b>
                <br/>
                <img src="/idtheft/images/line.gif" align="left" />
                <br/>
                <xforms:input bind="SI_PIIdentifierBind">
                    <xforms:label class="theftDetails-label">Identification Number </xforms:label>
                    <xforms:help><b>Identification Number: </b>The Identification number that was stolen</xforms:help>
                    <xforms:alert>001: The identification number must be a valid Identification number</xforms:alert>
                    <xforms:action ev:event="xforms-invalid" if="normalize-space(event('alert')) != ''">
                        <xforms:insert context="instance('errors-instance')" nodeset="error" origin="instance('error-template')"/>
                        <xforms:setvalue ref="instance('errors-instance')/error[index('errors-repeat')]/@id" value="substring(string(event('alert')),1,3)"/>
                        <xforms:setvalue ref="instance('errors-instance')/error[index('errors-repeat')]/@label" value="event('label')"/>
                        <xforms:setvalue ref="instance('errors-instance')/error[index('errors-repeat')]/@alert" value="substring(string(event('alert')),7)"/>
                    </xforms:action>
                    <xforms:action ev:event="xforms-valid" if="instance('errors-instance')/error[@id = substring(string(event('alert')),1,3)]">
                        <xforms:delete nodeset="instance('errors-instance')/error[@id = substring(string(event('alert')),1,3)]"/>
                    </xforms:action>
                </xforms:input>
                <br/>

...

Any advice would be greatly appreciated.

Thanks,
Dustin


--
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: Repeating Sections (almost working)

fl.schmitt(ops-users)
hi Dustin,

> I'm having trouble creating a repeating section in a form. I have the
> <xforms:repeat> section working with a <xforms:trigger> that adds new
> records. However, all the records seem to link to the same set of XML
> tags so that when I add a value to one it is echoed in the other
> instances. I have checked the resulting XML and Orbeon is adding an
> additional xml sections for each new instance I see on the screen.

> <xforms:bind id="SI_PIIdentifierBind"
>              type="xforms:string"
>              *nodeset="InvolvedIdentity/PIIdentifier"*
>              
> required="(instance('config-instance')/IncidentInvolvedIdentityActivity/InvolvedIdentity/PIIdentifier
> = 1)" />

>                 *<xforms:input bind="SI_PIIdentifierBind">*

i'm not sure, but i suppose this is a result of the "first-node rule" [1]: your
bind element refers to a nodeset, thats ok. But your input refers to that
nodeset, too. If there's more than one node in that nodeset, the first-node rule
  leads to a reference pointing to the first node - for *every* input element in
your repeat. To make it work, it should be sufficient to use a ref instead of a
bind in the input element.


HTH
florian

[1] http://www.w3.org/TR/2007/REC-xforms-20071029/#structure-attrs-single-node



--
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: Repeating Sections (almost working)

Dustin Henson-2

Thanks, using 'ref' seemed to link the fields to the appropriate XML instances. However, I've lost the 'required' functionality and the type. I tried copying down the rest of sections from the bind, but that didn't work. I wasn't able to find an example of a 'ref' input with that was required. Can you give me a pointer as to how to move these sections into the input?

Thanks again,
Dustin

On Sun, Jun 8, 2008 at 12:10 AM, Florian Schmitt <[hidden email]> wrote:
hi Dustin,


I'm having trouble creating a repeating section in a form. I have the <xforms:repeat> section working with a <xforms:trigger> that adds new records. However, all the records seem to link to the same set of XML tags so that when I add a value to one it is echoed in the other instances. I have checked the resulting XML and Orbeon is adding an additional xml sections for each new instance I see on the screen.

<xforms:bind id="SI_PIIdentifierBind"
            type="xforms:string"
            *nodeset="InvolvedIdentity/PIIdentifier"*
            required="(instance('config-instance')/IncidentInvolvedIdentityActivity/InvolvedIdentity/PIIdentifier = 1)" />

               *<xforms:input bind="SI_PIIdentifierBind">*

i'm not sure, but i suppose this is a result of the "first-node rule" [1]: your bind element refers to a nodeset, thats ok. But your input refers to that nodeset, too. If there's more than one node in that nodeset, the first-node rule  leads to a reference pointing to the first node - for *every* input element in your repeat. To make it work, it should be sufficient to use a ref instead of a bind in the input element.


HTH
florian

[1] http://www.w3.org/TR/2007/REC-xforms-20071029/#structure-attrs-single-node



--
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: Repeating Sections (almost working)

fl.schmitt(ops-users)
Dustin,

> Thanks, using 'ref' seemed to link the fields to the appropriate XML
> instances. However, I've lost the 'required' functionality and the type.
> I tried copying down the rest of sections from the bind, but that didn't
> work. I wasn't able to find an example of a 'ref' input with that was
> required. Can you give me a pointer as to how to move these sections
> into the input?

i think this may be caused by the Xpath in the nodeset attribute of the
bind element. Does it still contain the relative path? I suppose you
will have to use the complete path here, as in your first example:

<xforms:bind id="SI_PIIdentifierBind"
              type="xforms:string"
 
nodeset="instance('default-instance')/IncidentInvolvedIdentityActivity/InvolvedIdentity/PIIdentifier"
 
required="(instance('config-instance')/IncidentInvolvedIdentityActivity/InvolvedIdentity/PIIdentifier
= 1)" />

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