Hi,
The xform below has 2 triggers (add and delete) linked to a repeated input element. All I want to do is to be able to enter different values in the repeated elements - but for some reason whatever value I enter in one of the boxes automatically copies itself to the other boxes as soon as I tab out or select another box... I guess there is something wrong with my binding - but I just don't see it! <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ev="http://www.w3.org/2001/xml-events"> <head> <title>Enquiry Form</title> <xforms:model> <xforms:submission id="save-submission" ref="instance('enquiry-instance')" action="/exist/rest/db/orbeon/repeat-test/repeat-test.xml" method="put" replace="none"/> <xforms:instance id="enquiry-instance"> <enquiry xmlns=""> <venue_postcode/> </enquiry> </xforms:instance> <xforms:bind id="venue_postcode" nodeset="/enquiry/venue_postcode"> <xforms:bind id="venue_postcode_1" nodeset="." type="xs:string"/> </xforms:bind> </xforms:model> </head> <body> <xforms:trigger ref="/enquiry/venue_postcode[4 > last()]"> <xforms:label>Add</xforms:label> <xforms:insert ev:event="DOMActivate" context="instance('enquiry-instance')" bind="venue_postcode" at="index('postcode-repeat')"/> <xforms:setvalue ref="/enquiry/venue_postcode" value=""></xforms:setvalue> </xforms:trigger> <xforms:trigger ref="/enquiry/venue_postcode[1 < last()]"> <xforms:label>Delete</xforms:label> <xforms:delete ev:event="DOMActivate" bind="venue_postcode" at="index('postcode-repeat')"/> </xforms:trigger> <br/> <xforms:repeat id="postcode-repeat" bind="venue_postcode"> <xforms:input bind="venue_postcode_1"> <xforms:label>Postcode:</xforms:label> </xforms:input> <br/> </xforms:repeat> <xforms:submit submission="save-submission"> <xforms:label>Save</xforms:label> </xforms:submit> </body> </html> Thanks Rob Walpole Devon Portal Developer E-mail [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 |
Administrator
|
Hi Robert,
I modified your example, see attached: 1. The input was not bound to the right node. Since you are in a repeat, you want to use ref="." instead of a bind attribute. 2. The setvalue in the Add trigger was not executed, because it didn't have a ev:event="DOMActivate". I added a xforms:action around the xforms:insert and xforms:setvalue. I hope this helps, Alex On 4/23/07, Robert Walpole <[hidden email]> wrote: > Hi, > > The xform below has 2 triggers (add and delete) linked to a repeated > input element. All I want to do is to be able to enter different values > in the repeated elements - but for some reason whatever value I enter in > one of the boxes automatically copies itself to the other boxes as soon > as I tab out or select another box... > > I guess there is something wrong with my binding - but I just don't see > it! > > <html > xmlns="http://www.w3.org/1999/xhtml" > xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:ev="http://www.w3.org/2001/xml-events"> > <head> > <title>Enquiry Form</title> > > <xforms:model> > > <xforms:submission id="save-submission" > ref="instance('enquiry-instance')" > action="/exist/rest/db/orbeon/repeat-test/repeat-test.xml" method="put" > replace="none"/> > > <xforms:instance id="enquiry-instance"> > <enquiry xmlns=""> > <venue_postcode/> > </enquiry> > </xforms:instance> > <xforms:bind id="venue_postcode" > nodeset="/enquiry/venue_postcode"> > <xforms:bind id="venue_postcode_1" nodeset="." > type="xs:string"/> > </xforms:bind> > > </xforms:model> > > </head> > <body> > > <xforms:trigger ref="/enquiry/venue_postcode[4 > last()]"> > <xforms:label>Add</xforms:label> > <xforms:insert ev:event="DOMActivate" > context="instance('enquiry-instance')" bind="venue_postcode" > at="index('postcode-repeat')"/> > <xforms:setvalue ref="/enquiry/venue_postcode" > value=""></xforms:setvalue> > </xforms:trigger> > > <xforms:trigger ref="/enquiry/venue_postcode[1 < last()]"> > <xforms:label>Delete</xforms:label> > <xforms:delete ev:event="DOMActivate" bind="venue_postcode" > at="index('postcode-repeat')"/> > </xforms:trigger> > <br/> > > <xforms:repeat id="postcode-repeat" bind="venue_postcode"> > <xforms:input bind="venue_postcode_1"> > <xforms:label>Postcode:</xforms:label> > </xforms:input> > <br/> > </xforms:repeat> > > <xforms:submit submission="save-submission"> > <xforms:label>Save</xforms:label> > </xforms:submit> > > </body> > </html> > > Thanks > Rob Walpole > Devon Portal Developer > E-mail [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 gaga.xml (2K) Download Attachment |
Thanks Alex, this seems to work nicely. I am on a bit of a learning curve with these XForms so I really appreciate your help. Also, I picked up on your widget tip - very useful :-)
Thanks again. Rob ________________________________ From: [hidden email] on behalf of Alessandro Vernet Sent: Mon 23/04/2007 20:09 To: [hidden email] Subject: Re: [ops-users] repeated input box copying values Hi Robert, I modified your example, see attached: 1. The input was not bound to the right node. Since you are in a repeat, you want to use ref="." instead of a bind attribute. 2. The setvalue in the Add trigger was not executed, because it didn't have a ev:event="DOMActivate". I added a xforms:action around the xforms:insert and xforms:setvalue. I hope this helps, Alex On 4/23/07, Robert Walpole <[hidden email]> wrote: > Hi, > > The xform below has 2 triggers (add and delete) linked to a repeated > input element. All I want to do is to be able to enter different values > in the repeated elements - but for some reason whatever value I enter in > one of the boxes automatically copies itself to the other boxes as soon > as I tab out or select another box... > > I guess there is something wrong with my binding - but I just don't see > it! > > <html > xmlns="http://www.w3.org/1999/xhtml" > xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:ev="http://www.w3.org/2001/xml-events"> > <head> > <title>Enquiry Form</title> > > <xforms:model> > > <xforms:submission id="save-submission" > ref="instance('enquiry-instance')" > action="/exist/rest/db/orbeon/repeat-test/repeat-test.xml" method="put" > replace="none"/> > > <xforms:instance id="enquiry-instance"> > <enquiry xmlns=""> > <venue_postcode/> > </enquiry> > </xforms:instance> > <xforms:bind id="venue_postcode" > nodeset="/enquiry/venue_postcode"> > <xforms:bind id="venue_postcode_1" nodeset="." > type="xs:string"/> > </xforms:bind> > > </xforms:model> > > </head> > <body> > > <xforms:trigger ref="/enquiry/venue_postcode[4 > last()]"> > <xforms:label>Add</xforms:label> > <xforms:insert ev:event="DOMActivate" > context="instance('enquiry-instance')" bind="venue_postcode" > at="index('postcode-repeat')"/> > <xforms:setvalue ref="/enquiry/venue_postcode" > value=""></xforms:setvalue> > </xforms:trigger> > > <xforms:trigger ref="/enquiry/venue_postcode[1 < last()]"> > <xforms:label>Delete</xforms:label> > <xforms:delete ev:event="DOMActivate" bind="venue_postcode" > at="index('postcode-repeat')"/> > </xforms:trigger> > <br/> > > <xforms:repeat id="postcode-repeat" bind="venue_postcode"> > <xforms:input bind="venue_postcode_1"> > <xforms:label>Postcode:</xforms:label> > </xforms:input> > <br/> > </xforms:repeat> > > <xforms:submit submission="save-submission"> > <xforms:label>Save</xforms:label> > </xforms:submit> > > </body> > </html> > > Thanks > Rob Walpole > Devon Portal Developer > E-mail [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 winmail.dat (13K) Download Attachment |
Free forum by Nabble | Edit this page |