Troubles with dynamically populating control structures

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

Troubles with dynamically populating control structures

dcrensha
I am having difficulty populating a control structure directly from a query. My goal being to read from a user table and populate a select structure with the users that match the criteria set forth in the query. However, when I do this:

<xforms:select1 ref="users" id="user-select">
   <xforms:label>Active Users </xforms:label>
   <xforms:item>
       <xforms:label>Choose One...</xforms:label>
       <xforms:value/>
   </xforms:item>
   <xforms:repeat nodeset="users" id="users-repeat">
       <xforms:item>
           <xforms:label ref="name_concat"/>
           <xforms:value ref="user_id"/>
       </xforms:item>
   </xforms:repeat>
</xforms:select1>

only the first person the query returns shows up in the list. I have included a regular xforms:output into a table above to make sure my results are all coming through; which they are... So how to I take information from the query and populate my select structure properly?


I have attached a tar of the relevant bits of my project, hopefully it will be a simple mistake on my part.

dynamic-control-population.tar.gz
Reply | Threaded
Open this post in threaded view
|

Re: Troubles with dynamically populating control structures

Alexander Žaťko
Not sure if repeat within the select1 is supported by the spec - try itemset instead to see if that helps.

On May 29, 2008, at 4:44 PM, dcrensha wrote:


I am having difficulty populating a control structure directly from a query.
My goal being to read from a user table and populate a select structure with
the users that match the criteria set forth in the query. However, when I do
this:

<xforms:select1 ref="users" id="user-select">
  <xforms:label>Active Users </xforms:label>
  <xforms:item>
      <xforms:label>Choose One...</xforms:label>
      <xforms:value/>
  </xforms:item>
&! nbsp;&nbs et="users" id="users-repeat">
      <xforms:item>
          <xforms:label ref="name_concat"/>
          <xforms:value ref="user_id"/>
      </xforms:item>
  </xforms:repeat>
</xforms:select1>

only the first person the query returns shows up in the list. I have
included a regular xforms:output into a table above to make sure my results
are all coming through; which they are... So how to I take information from
the query and populate my select structure properly?


I have attached a tar of the relevant bits of my project, hopefully it will
be a simple mistake on my part.

http://www.nabble.com/file/p17536259/dynamic-control-population.tar.gz
dynamic-! control-p br>View this message in context: http://www.nabble.com/Troubles-with-dynamically-populating-control-structures-tp17536259p17536259.html
Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.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
OW2 mailing lists service home page: http://www.ow2.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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Troubles with dynamically populating control structures

Erik Bruchez
Administrator
As per XForms, <xforms:repeat> is not supported within <xforms:select1>.

You are right, you must use <xforms:itemset nodeset="..."> instead.

-Erik

On May 29, 2008, at 5:45 PM, Alexander Zatko wrote:

> Not sure if repeat within the select1 is supported by the spec - try  
> itemset instead to see if that helps.
>
> On May 29, 2008, at 4:44 PM, dcrensha wrote:
>
>>
>> I am having difficulty populating a control structure directly from  
>> a query.
>> My goal being to read from a user table and populate a select  
>> structure with
>> the users that match the criteria set forth in the query. However,  
>> when I do
>> this:
>>
>> <xforms:select1 ref="users" id="user-select">
>>   <xforms:label>Active Users </xforms:label>
>>   <xforms:item>
>>       <xforms:label>Choose One...</xforms:label>
>>       <xforms:value/>
>>   </xforms:item>
>> &! nbsp;&nbs et="users" id="users-repeat">
>>       <xforms:item>
>>           <xforms:label ref="name_concat"/>
>>           <xforms:value ref="user_id"/>
>>       </xforms:item>
>>   </xforms:repeat>
>> </xforms:select1>
>>
>> only the first person the query returns shows up in the list. I have
>> included a regular xforms:output into a table above to make sure my  
>> results
>> are all coming through; which they are... So how to I take  
>> information from
>> the query and populate my select structure properly?
>>
>>
>> I have attached a tar of the relevant bits of my project, hopefully  
>> it will
>> be a simple mistake on my part.
>>
>> http://www.nabble.com/file/p17536259/dynamic-control- 
>> population.tar.gz
>> dynamic-! control-p br>View this message in context: http://www.nabble.com/Troubles-with-dynamically-populating-control-structures-tp17536259p17536259.html
>> Sent from the ObjectWeb OPS - Users mailing list archive at  
>> Nabble.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
>> OW2 mailing lists service home page: http://www.ow2.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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Troubles with dynamically populating control structures

dcrensha
(Pardon the email Erik, I hit the wrong reply button.)

With the repeat (even though it isn't supported) I get at least something from the users. When I use the xforms:itemset I don't see anything except the dummy Choose One entry manually defined in the select1 declaration. Is ther a special format in the nodeset string I have to use to reference my SQL call? To be specific: here's what I changed it to:

<xforms:select1 ref="users" id="user-select">
    <xforms:label>Active Users </xforms:label>
    <xforms:item>
        <xforms:label>Choose One...</xforms:label>
        <xforms:value></xforms:value>
    </xforms:item>
        <xforms:itemset nodeset="users" id="users-repeat">
            <xforms:label ref="name_concat"/>
            <xforms:value ref="user_id"/>
        </xforms:itemset>
</xforms:select1>

Which I believed to, for every user in the query, put an item in the select1 control. Am I using the itemset tag the correct way here?
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Troubles with dynamically populating control structures

Alexander Žaťko
I believe the itemset's nodeset attribute context is determined by the  
@ref value of the select1 element, so your XForm's instance should  
contain the following structure if you expect the select1 to work as  
shown:

<users>
<users>
        <name_concat/>
        <name_concat/>
        ....
</users>
</users>

If you don't make it work, send a test case that can be run in sandbox.

A.

On May 29, 2008, at 8:30 PM, dcrensha wrote:

>
> (Pardon the email Erik, I hit the wrong reply button.)
>
> With the repeat (even though it isn't supported) I get at least  
> something
> from the users. When I use the xforms:itemset I don't see anything  
> except
> the dummy Choose One entry manually defined in the select1  
> declaration. Is
> ther a special format in the nodeset string I have to use to  
> reference my
> SQL call? To be specific: here's what I changed it to:
>
> <xforms:select1 ref="users" id="user-select">
>    <xforms:label>Active Users </xforms:label>
>    <xforms:item>
>        <xforms:label>Choose One...</xforms:label>
>        <xforms:value></xforms:value>
>    </xforms:item>
>        <xforms:itemset nodeset="users" id="users-repeat">
>            <xforms:label ref="name_concat"/>
>            <xforms:value ref="user_id"/>
>        </xforms:itemset>
> </xforms:select1>
>
> Which I believed to, for every user in the query, put an item in the  
> select1
> control. Am I using the itemset tag the correct way here?
> --
> View this message in context: http://www.nabble.com/Troubles-with-dynamically-populating-control-structures-tp17536259p17542831.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.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
> OW2 mailing lists service home page: http://www.ow2.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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Troubles with dynamically populating control structures

Erik Bruchez
Administrator
In reply to this post by dcrensha
As suggested, the @ref attribute changes the XPath evaluation context  
for @nodeset

What does your instance data look like? Including:

* Where are the items defined
* Where do you want to store the selected value

-Erik

On May 29, 2008, at 8:30 PM, dcrensha wrote:

>
> (Pardon the email Erik, I hit the wrong reply button.)
>
> With the repeat (even though it isn't supported) I get at least  
> something
> from the users. When I use the xforms:itemset I don't see anything  
> except
> the dummy Choose One entry manually defined in the select1  
> declaration. Is
> ther a special format in the nodeset string I have to use to  
> reference my
> SQL call? To be specific: here's what I changed it to:
>
> <xforms:select1 ref="users" id="user-select">
>    <xforms:label>Active Users </xforms:label>
>    <xforms:item>
>        <xforms:label>Choose One...</xforms:label>
>        <xforms:value></xforms:value>
>    </xforms:item>
>        <xforms:itemset nodeset="users" id="users-repeat">
>            <xforms:label ref="name_concat"/>
>            <xforms:value ref="user_id"/>
>        </xforms:itemset>
> </xforms:select1>
>
> Which I believed to, for every user in the query, put an item in the  
> select1
> control. Am I using the itemset tag the correct way here?
> --
> View this message in context: http://www.nabble.com/Troubles-with-dynamically-populating-control-structures-tp17536259p17542831.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Troubles with dynamically populating control structures

dcrensha
In reply to this post by Alexander Žaťko
Actually I figured it out. I was referencing the query directly, when the way I had it set up was to stuff the query into a dummy instance. When referenced that way, it worked fine.

ie. nodeset="instance('main')/users"

Thanks for all your help guys.