Hi, I am using an xforms:repeat to display a table, the table contains other xforms controls (text boxes, submit buttons etc.) I want to give the text boxes and submit buttons unique ids. E.g. <xforms:repeat nodeset="/fundingApplication/projectSummary/milestones/milestone" id="milestoneSet">
</xforms:submit>
I have tried using xslt, index() function, various xpaths etc., but nothing has worked so far. I am using OPS 2.8. Is there an easy way to do what I need in 2.8? Thanks, ---------------------------------------------------------------------
[hidden email]
consulting | development | training | support
-- 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 |
Alan,
See the email thread called "accessing index of repeat element to control UI features" from August 16. The stuff discussed there could be of some relevance to your issue. A. On Sep 16, 2005, at 2:27 AM, Alan Skorkin wrote: > Hi, > > I am using an xforms:repeat to display a table, the table contains > other xforms controls (text boxes, submit buttons etc.) > > I want to give the text boxes and submit buttons unique ids. > > E.g. > > <xforms:repeat > nodeset="/fundingApplication/projectSummary/milestones/milestone" > id="milestoneSet"> > <xhtml:tr> > <xhtml:td> > <xforms:input ref="name" > xhtml:id="UNIQUE_ID_BASED_ON_INDEX_OF_ROW"> > <xforms:help ref="@help"/> > <xforms:hint ref="@hint"/> > <xforms:alert ref="@alert"/> > </xforms:input> > </xhtml:td> > <xhtml:td align="center"> > <xforms:submit > xhtml:id="UNIQUE_ID_BASED_ON_INDEX_OF_ROW"> > <xforms:label>Delete</xforms:label> > <xforms:delete > nodeset="/fundingApplication/projectSummary/milestones/milestone" > at="index('milestoneSet')"/> > > </xforms:submit> > </xhtml:td> > </xhtml:tr> > </xforms:repeat> > > I have tried using xslt, index() function, various xpaths etc., but > nothing has worked so far. > > I am using OPS 2.8. Is there an easy way to do what I need in 2.8? > > Thanks, > > --------------------------------------------------------------------- > Alan Skorkin > Consultant > Object Consulting > > [hidden email] > www.objectconsulting.com.au > > consulting | development | training | support > Our Experience Makes The Difference > --------------------------------------------------------------------- > > -- > 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 -- 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
|
In reply to this post by Alan Skorkin
Do you mean that you want each generated row in HTML to have different
ids for the repeated HTML elements in that row? E.g. row 1 input field has id "myinput1", row 2 input has "myinput2", etc.? The XForms controls are generated by the XForms engine, and you do not have control over much with XForms repeat. If you use XSLT, you are outside the realm of the XForms engine and you are going to have unexpected results. With 3.0, the XSLT solution definitely won't work. But with 3.0, unique ids are already automatically generated by the XForms engine. What are you trying to achieve exactly with those ids? Maybe this could help figure out the best solution in the 2.8 case. -Erik > Hi, > > I am using an xforms:repeat to display a table, the table contains other > xforms controls (text boxes, submit buttons etc.) > > I want to give the text boxes and submit buttons unique ids. > > E.g. > > <xforms:repeat > nodeset="/fundingApplication/projectSummary/milestones/milestone" > id="milestoneSet"> > <xhtml:tr> > <xhtml:td> > <xforms:input ref="name" > xhtml:id="UNIQUE_ID_BASED_ON_INDEX_OF_ROW"> > <xforms:help ref="@help"/> > <xforms:hint ref="@hint"/> > <xforms:alert ref="@alert"/> > </xforms:input> > </xhtml:td> > <xhtml:td align="center"> > <xforms:submit > xhtml:id="UNIQUE_ID_BASED_ON_INDEX_OF_ROW"> > <xforms:label>Delete</xforms:label> > <xforms:delete > nodeset="/fundingApplication/projectSummary/milestones/milestone" > at="index('milestoneSet')"/> > </xforms:submit> > </xhtml:td> > </xhtml:tr> > </xforms:repeat> > > I have tried using xslt, index() function, various xpaths etc., but nothing > has worked so far. > > I am using OPS 2.8. Is there an easy way to do what I need in 2.8? > > Thanks, > > --------------------------------------------------------------------- > Alan Skorkin > Consultant > Object Consulting > > [hidden email] > www.objectconsulting.com.au <www.objectconsulting.com.au> > > consulting | development | training | support > Our Experience Makes The Difference > --------------------------------------------------------------------- -- 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 |
In reply to this post by Alan Skorkin
That's exactly what I am trying to do (row 1 input field has id "myinput1", row 2 input has "myinput2", etc). There are several reasons why I need those unique ids. A major one is for testing purposes. We are doing automated tests for our forms, so you can do things like assert that controls with various ids are on the form, or press a button with a particular id to make sure you get an expected result. The other reason for accessibility, certain accesibility requirements that we have basically require us to have an id on most html fields. Any ideas you might have would be appreciated. -----Original Message-----
Do you mean that you want each generated row in HTML to have different ids for the repeated HTML elements in that row? E.g. row 1 input field has id "myinput1", row 2 input has "myinput2", etc.? The XForms controls are generated by the XForms engine, and you do not have control over much with XForms repeat. If you use XSLT, you are outside the realm of the XForms engine and you are going to have unexpected results. With 3.0, the XSLT solution definitely won't work. But with 3.0, unique ids are already automatically generated by the XForms engine. What are you trying to achieve exactly with those ids? Maybe this could help figure out the best solution in the 2.8 case. -Erik > Hi,
-- 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
|
For the classic XForms engine, this can be done in
xforms-to-xhtml.xsl, whose purpose is to convert annotated XForms controls to XHTML. The input of xforms-to-xhtml.xsl looks like this: <xforms:repeat nodeset="claim:children/claim:child" id="childSet"> <xforms:group xxforms:position="1" xxforms:readonly="false" xxforms:relevant="true" xxforms:required="false" xxforms:valid="true"> ... </xforms:group> <xforms:group xxforms:position="2" xxforms:readonly="false" xxforms:relevant="true" xxforms:required="false" xxforms:valid="true"> ... </xforms:group> </xforms:repeat> Based on this information, you can match on xforms:repeat and update / set unique ids on the children XForms controls. The "tunnel" attribute of XSLT 2.0 will come handy to do this. -Erik Alan Skorkin wrote: > That's exactly what I am trying to do (row 1 input field has id > "myinput1", row 2 input has "myinput2", etc). > > There are several reasons why I need those unique ids. A major one is > for testing purposes. We are doing automated tests for our forms, so you > can do things like assert that controls with various ids are on the > form, or press a button with a particular id to make sure you get an > expected result. > > The other reason for accessibility, certain accesibility requirements > that we have basically require us to have an id on most html fields. > > Any ideas you might have would be appreciated. -- 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 |
In reply to this post by Alan Skorkin
This sounds very promising, but if you match on xforms:repeat, it seems you then need to specify how to handle all the nested elements which include xhtml:tr, xhtml:td, xforms:group etc. Alternatively you can do <apply-templates/> (which is what I tried) but then none of the changes you do in the <xforms:repeat> template come through, since they get overridden when you apply templates. So, could you please provide more information or an example of how to do this? I would really appreciate it. Thanks, -----Original Message-----
For the classic XForms engine, this can be done in xforms-to-xhtml.xsl, whose purpose is to convert annotated XForms controls to XHTML. The input of xforms-to-xhtml.xsl looks like this: <xforms:repeat nodeset="claim:children/claim:child" id="childSet">
Based on this information, you can match on xforms:repeat and update / set unique ids on the children XForms controls. The "tunnel" attribute of XSLT 2.0 will come handy to do this. -Erik Alan Skorkin wrote:
>
>
-- 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
|
Alan,
I think the best way to go consists in using the "tunnel" attribute of XSLT 2.0. The match on xforms:repeat does something like this at some point: <xsl:apply-templates> <xsl:with-param name="repeat-id" tunnel="yes"/> </xsl:apply-templates> Then nested elements must have templates with xsl:param as follows: <xsl:param name="repeat-id" select="''" tunnel="yes"/> With this mechanism, called template can access the "repeat-id" parameter, if any has been set. If none has been set, then the "repeat-id" parameter will be the empty string. Something similar is done in xforms-to-ajax-xhtml.xsl to pass an "id-postfix" for xforms:repeat. I hope this helps, -Erik Alan Skorkin wrote: > This sounds very promising, but if you match on xforms:repeat, it seems > you then need to specify how to handle all the nested elements which > include xhtml:tr, xhtml:td, xforms:group etc. Alternatively you can do > <apply-templates/> (which is what I tried) but then none of the changes > you do in the <xforms:repeat> template come through, since they get > overridden when you apply templates. > > So, could you please provide more information or an example of how to do > this? I would really appreciate it. > > Thanks, > > -----Original Message----- > From: Erik Bruchez [mailto:[hidden email]] > Sent: Friday, September 23, 2005 1:17 PM > To: [hidden email] > Subject: Re: [ops-users] Access row in inside xforms:repeat > > For the classic XForms engine, this can be done in xforms-to-xhtml.xsl, > whose purpose is to convert annotated XForms controls to XHTML. The > input of xforms-to-xhtml.xsl looks like this: > > <xforms:repeat nodeset="claim:children/claim:child" id="childSet"> > <xforms:group xxforms:position="1" xxforms:readonly="false" > xxforms:relevant="true" xxforms:required="false" xxforms:valid="true"> > ... > </xforms:group> > <xforms:group xxforms:position="2" xxforms:readonly="false" > xxforms:relevant="true" xxforms:required="false" xxforms:valid="true"> > ... > </xforms:group> > </xforms:repeat> > > Based on this information, you can match on xforms:repeat and update / > set unique ids on the children XForms controls. The "tunnel" attribute > of XSLT 2.0 will come handy to do this. > > -Erik > > Alan Skorkin wrote: > > That's exactly what I am trying to do (row 1 input field has id > > "myinput1", row 2 input has "myinput2", etc). > > > > There are several reasons why I need those unique ids. A major one > is > for testing purposes. We are doing automated tests for our forms, > so you > can do things like assert that controls with various ids are > on the > form, or press a button with a particular id to make sure you > get an > expected result. > > > > > The other reason for accessibility, certain accesibility > requirements > that we have basically require us to have an id on most > html fields. > > > > > Any ideas you might have would be appreciated. > > > ------------------------------------------------------------------------ > > > -- > 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 -- 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 |
Free forum by Nabble | Edit this page |