Login  Register

RE: Re:

Posted by mar on Dec 17, 2009; 12:24am
URL: https://discuss.orbeon.com/no-subject-tp965448p965670.html

Alex,

Not exactly. We need to populate a GUI control with what that user chose
from the xforms:select (in a Flex app from the xforms generated XML). We
want to display the <label> values. For example, Windows, Unix not
windows, unix. So somehow I need to iterate through the list of selected
values and capture the labels, comma separate the labels and setvalue
them into the @label attribute of the serverOperatingSystem element on
"xforms-value-changed xforms-enabled". This is my guess. If I'm doing
this totally wrong please tell me. This seems to me like something that
should be easy but I'm just not seeing the easy way.

<xforms:instance id="addServer-serverOperatingSystem-instance">
<data>
 <row>
  <label>Windows</label>
  <value>windows</value>
 </row>
 <row>
  <label>Unix</label>
  <value>unix</value>
 </row>
 <row>
  <label>Linux</label>
  <value>linux</value>
 </row>
 </data>
</xforms:instance>


This captures the label for a single xforms:select1 list but does not
work for a multi xforms:select list.

<xforms:select1 ref="serverOperatingSystem">

<other stuff needed for select1>

<xforms:action ev:event="xforms-value-changed xforms-enabled">
 <xxforms:variable name="theValue"
select="xxforms:instance('addServers-instance')/addServer/serverOperatin
gSystem"/>
 <xforms:setvalue
ref="xxforms:instance('addServers-instance')/addServer/serverOperatingSy
stem/@label"
value="xxforms:instance('addServer-serverOperatingSystem-instance')/row[
contains(.//value, $theValue)]/label"/>
 <xforms:setvalue
ref="xxforms:instance('addServers-instance')/addServer/serverOperatingSy
stem"
value="xxforms:instance('addServer-serverOperatingSystem-instance')/row[
contains(.//value, $theValue)]/value"/>
</xforms:action>

</xforms:select1>

p.s. this does not work if the data for the list is retrieved from on
.xpl query to our MS SQL Server DB. It only works when the items come
from an xforms:instance. This is a problem I've described (and need to
solve) in the past few days.


Thanks.

Martin



________________________________

From: Alessandro Vernet [mailto:[hidden email]]
Sent: Wednesday, December 16, 2009 4:57 PM
To: [hidden email]
Subject: [ops-users] Re:


Martin,

So compared to what the xforms:select does out of the box, you need the
list of selected values to be coma separated, rather than space
separated as the xforms:select does "by default"?

Alex

On Dec 16, 2009, at 10:27 AM, "Schwartzman, Martin"
<[hidden email]> wrote:



        How do you call a JavaScript function from within a
<xforms:select/> on the "xforms-value-changed" event? I've attached a
sample view.xhtml where I get the below error when I try to run it:
         
        XML Parsing Error: no element found
        Location:
<http://localhost:8080/orbeon/xforms-sr/view.xhtml?order-id=256>
http://localhost:8080/orbeon/xforms-sr/view.xhtml?order-id=256
        Line Number 1, Column 1:
         
        What I need to be able to do is create a comma separated list of
item labels that were chosen in the <select/> control and insert it into
the select ref="serverOperatindSystem" elements label attribute. Any
ideas on the best way to do this (if not via JavaScript) would be
greatly appreciated.
         
         
        Thanks.
         
        Martin Schwartzman
         

        <view.xhtml>

       
        --
        You receive this message as a subscriber of the
[hidden email] mailing list.
        To unsubscribe: <mailto:[hidden email]>
mailto:[hidden email]
        For general help: <mailto:[hidden email]?subject=help>
mailto:[hidden email]?subject=help
        OW2 mailing lists service home page: <http://www.ow2.org/wws>
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