Re: [Xsltforms-support] Problem with checkboxes in xf:repeat
Brought to you by:
alain-couthures
From: <ala...@ag...> - 2015-02-09 07:19:54
|
Hello Tim, XForms allows to have the same node being bound to many controls and all of these controls, as a consequence, are synchronized on updates. In your example, there is just one off element in a distinct instance. When an input control is bound to this element within a repeat, the XForms engine is rendering as many identical controls as nodes in the repeat node set. I guess that you want to check records: for this, you need, for example, a dedicated attribute within each record. This can be done with XForms actions: each time the records instance is retrieved from the server, an associated action can insert such an attribute. With eXistdb, it might be easier to ask the server to generate the records instance with this extra attribute. Thank you for your feedback! --Alain > Le 7 février 2015 à 16:02, Tim Thompson <tim...@gm...> a écrit : > > Hello, > > I am new to XForms and am using XSLTForms in eXist 2.2 to work on an XRX app > with RESTXQ. > > I have a search form that lets users query a remote API, which responds with > a set of XML records if the query is matched. I am using xf:repeat to output > content from the records, and I want to be able to provide a checkbox at the > start of each record, so that the user can choose. However, when I place a > checkbox inside the repeat (using xf:input bound to a boolean), I don't get > the desired functionality. Instead of being independent of each other, the > checkboxes get activated as a group. When I click the first box, the second > box is activated as well, etc. > > Model: > > <xf:instance xmlns="" id="test"> > <data> > <off>false</off> > </data> > </xf:instance> > > <xf:bind nodeset="instance('test')/off" id="offVal" type="xs:boolean"/> > > Form: > > <div> > <xf:repeat > nodeset="instance('default')/sru:searchRetrieveResponse/sru:records/sru:record" > id="marc-repeat" appearance="full"> > <div class="checkbox"> > <xf:input incremental="true" ref="instance('test')/off"> > <xf:label>Select</xf:label> > </xf:input> > </div> > ... > </xf:repeat> > </div> > > Thanks in advance, > Tim > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming. The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. > http://goparallel.sourceforge.net/_______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support > |