Try this again -- problem with dropdowns in xforms:repeat

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

Try this again -- problem with dropdowns in xforms:repeat

mfpaschal

Hi Folks,

Lets try this again (my last post sent before I finished). I have an instance
that looks like:
<xforms:instance id="forms-instance">
        <forms xmlns="">
            <form>
              <the-value/>
              <label></label>
                 ... other fields ...
              <items xmlns="">
                <item>
                    <label>Choose One...</label>
                    <value></value>
                </item>
                <item>
                    <label>Some label</>
                    <value></value>
                </item>
                 … more items …
            </form>
             … more forms …
        </forms>
</xforms:instance>
The items are generated dynamically and inserted into the data structure.
Elsewhere in my code I have a <xforms:repeat> statement:
     <xforms:repeat nodeset="instance('forms-instance')/form" id="form-repeat">
        … code …
    </xforms:repeat>
Within the <xforms:repeat> I want to put up the dropdowns that were dynamically
generated. So,
I try:
    <xforms:select1 ref="the-value">
        <xforms:itemset nodeset="items">
           <xforms:label ref="label"/>
          <xforms:value ref="value"/>
    </xforms:itemset>
  </xforms:select1>
The dropdown is displayed without any of the items. So, I tried to see if I
could get anywhere with use of position(). I tried:
    <xforms:select1 ref="the-value">
        <xforms:itemset
nodeset="nodeset="instance('forms-instance')/form[position()]/items/item">
           <xforms:label ref="label"/>
          <xforms:value ref="value"/>
    </xforms:itemset>
  </xforms:select1>
This time I got my items. I got ALL items for all the elements in the instance
for every select1 statement in the <xforms:repeat>.

Just to make sure I was not completely insane, I tried the following
<xforms:itemset>:
   <xforms:itemset
nodeset="nodeset="instance('forms-instance')/[1]]/items/item">
This time I got items in my dropdown for just the first “form” in the
forms-instance. I got this for every dropdown since it is hardcoded.

Does anyone have any suggestions on how to do this? I am stumped.

Any help would be most welcome!
Thanks,
Mike Paschal


--
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: Try this again -- problem with dropdowns in xforms:repeat

Erica Smith
Hi Mike,

I have a feeling the nodeset inside the itemset tag might be relative to the ref of its parent node? Try changing this line:
<xforms:itemset nodeset="items">
to:
<xforms:itemset nodeset="../items">

Regards,
Erica


-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
Sent: Thursday, June 03, 2010 2:10 PM
To: [hidden email]
Subject: [ops-users] Try this again -- problem with dropdowns in xforms:repeat


Hi Folks,

Lets try this again (my last post sent before I finished). I have an instance that looks like:
<xforms:instance id="forms-instance">
        <forms xmlns="">
            <form>
              <the-value/>
              <label></label>
                 ... other fields ...
              <items xmlns="">
                <item>
                    <label>Choose One...</label>
                    <value></value>
                </item>
                <item>
                    <label>Some label</>
                    <value></value>
                </item>
                 … more items …
            </form>
             … more forms …
        </forms>
</xforms:instance>
The items are generated dynamically and inserted into the data structure.
Elsewhere in my code I have a <xforms:repeat> statement:
     <xforms:repeat nodeset="instance('forms-instance')/form" id="form-repeat">
        … code …
    </xforms:repeat>
Within the <xforms:repeat> I want to put up the dropdowns that were dynamically generated. So, I try:
    <xforms:select1 ref="the-value">
        <xforms:itemset nodeset="items">
           <xforms:label ref="label"/>
          <xforms:value ref="value"/>
    </xforms:itemset>
  </xforms:select1>
The dropdown is displayed without any of the items. So, I tried to see if I could get anywhere with use of position(). I tried:
    <xforms:select1 ref="the-value">
        <xforms:itemset
nodeset="nodeset="instance('forms-instance')/form[position()]/items/item">
           <xforms:label ref="label"/>
          <xforms:value ref="value"/>
    </xforms:itemset>
  </xforms:select1>
This time I got my items. I got ALL items for all the elements in the instance for every select1 statement in the <xforms:repeat>.

Just to make sure I was not completely insane, I tried the following
<xforms:itemset>:
   <xforms:itemset
nodeset="nodeset="instance('forms-instance')/[1]]/items/item">
This time I got items in my dropdown for just the first “form” in the forms-instance. I got this for every dropdown since it is hardcoded.

Does anyone have any suggestions on how to do this? I am stumped.

Any help would be most welcome!
Thanks,
Mike Paschal


--
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