W3C home > Mailing lists > Public > www-forms@w3.org > November 2003

Problem displaying repeated fields

From: DuCharme, Bob (LNG-CHO) <bob.ducharme@lexisnexis.com>
Date: Wed, 5 Nov 2003 12:46:30 -0500
Message-ID: <FEF4858E8AB32D4EAC2CF2A7D85386EBE52E45@lnxdayexch06.lexis-nexis.com>
To: "'www-forms@w3.org'" <www-forms@w3.org>

I want the following XForm to add either a foo:beta element or one of the
two foo:delta elements shown in xf:instance each time I press one of the
trigger buttons. Adding beta works, and each of the xf:instance delta
elements shows up on the form when I first load the form into XSmiles .82,
but clicking "Add red delta" or "Add blue delta" doesn't add anything to the
form, although they do add those elements to the instance created by the
submission. What am I doing wrong?

thanks,

Bob

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ev="http://www.w3.org/2001/xml-events" 
      xmlns:xf="http://www.w3.org/2002/xforms"
      xmlns:foo="http://foo">
  <head>
    <xf:model id="model1">
      <xf:instance>
        <foo:alpha>
          <foo:beta color="yellow"/>
          <foo:delta color="red"  flavor="mint"/>
          <foo:delta color="blue" direction="north"/>
        </foo:alpha>
      </xf:instance>
      <xf:submission id="s01" method="put" action="file:///temp/alpha.xml"
/> 
    </xf:model>
  </head>

  <body>

    <xf:trigger id="addBetaButton">
      <xf:label>Add Beta</xf:label>
      <xf:insert nodeset="foo:beta" at="last()" position="after"
                 ev:event="xforms-activate"/>
    </xf:trigger>

    <xf:trigger id="addDeltaBlueButton">
      <xf:label>Add blue Delta</xf:label>
      <xf:insert nodeset="foo:delta[@color='blue']"
                 at="last()" position="after"
                 ev:event="xforms-activate"/>
    </xf:trigger>

    <xf:trigger id="addDeltaRedButton">
      <xf:label>Add red Delta</xf:label>
      <xf:insert nodeset="foo:delta[@color='red']"
                 at="last()" position="after"
                 ev:event="xforms-activate"/>
    </xf:trigger>

    <xf:submit submission="s01">
      <xf:label>Save</xf:label>
      <xf:hint>Click here to save your alpha document.</xf:hint>
    </xf:submit>

    <xf:repeat nodeset="foo:beta">
      <xf:input ref="."><xf:label>beta</xf:label></xf:input>
      <xf:input ref="@color">
        <xf:label>beta color</xf:label>
      </xf:input>
    </xf:repeat>

    <xf:repeat nodeset="foo:delta[@color='red']">
      <xf:input ref="@color">
        <xf:label>delta color</xf:label>
      </xf:input>
      <xf:input ref="@flavor">
        <xf:label>delta flavor</xf:label>
      </xf:input>
    </xf:repeat>

    <xf:repeat nodeset="foo:delta[@color='blue']">
      <xf:input ref="@color">
        <xf:label>delta color</xf:label>
      </xf:input>
      <xf:input ref="@direction">
        <xf:label>delta direction</xf:label>
      </xf:input>
    </xf:repeat>

  </body>
</html>
Received on Wednesday, 5 November 2003 12:49:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:21:56 GMT