setvalue problem copying data from one instance to another instance

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

setvalue problem copying data from one instance to another instance

ritesh a
Hi,
 
I am new to OPS. I am trying to copy the data from one instance to another using setvalue.
It does not seem to work. Ideally I want to copy data from once instance to another using
xform-ready event.
 
In the following example I am using an action in submit to copy data.
 
 
Note if I use literal value then copy works fine, something like:
 
<xforms:setvalue  xmlns:po="http://wlmse.sample/po"  model="outputModel" ref="instance('output')/po:orderId" >11222</xforms:setvalue>
 
But this does not:
 
<xforms:setvalue  xmlns:po="http://wlmse.sample/po"  model="outputModel" ref="instance('output')/po:orderId" value="instance('input')/po:orderId"></xforms:setvalue>
 
Any help is appreciated.
 
Thanks
Ritesh
 
Here is the xform which does not work:
 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xforms="http://www.w3.org/2002/xforms"
      xmlns:xf="http://www.w3.org/2002/xforms"
      xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
   
<style type="text/css">
    tr {color: red}
    body {background-color: blue}
</style>
   
<xforms:model xmlns:xforms="http://www.w3.org/2002/xforms" id="inputModel">
 <xforms:instance id="input">
  <inputMsg xmlns="">  
   <po:orderId xmlns:po="http://wlmse.sample/po">1111</po:orderId>  
   <po:purchaserName xmlns:po="http://wlmse.sample/po">Joe</po:purchaserName>  
   <po:productId xmlns:po="http://wlmse.sample/po">watch-diamond-sku-12</po:productId>  
   <po:amount xmlns:po="http://wlmse.sample/po">1000.00</po:amount>   
  </inputMsg>
</xforms:instance>
 
</xforms:model>
<xforms:model xmlns:xforms="http://www.w3.org/2002/xforms" id="outputModel">
 <xforms:instance id="output">
 <outputMsg xmlns="">  
   <po:orderId xmlns:po="http://wlmse.sample/po"/>  
   <po:approveResult xmlns:po="http://wlmse.sample/po">Approved</po:approveResult>  
   <po:approveDate xmlns:po="http://wlmse.sample/po"/>  
   <po:description xmlns:po="http://wlmse.sample/po"/>
  </outputMsg>
 </xforms:instance>
   
 <xforms:submission id="default-submission" method="post" action="../worklist/save.view?taskId=1"
                    replace="all"/>

 
     </xforms:model>
</head>
<body>
   
 <inputXForm>  
 <xforms:group xmlns:xforms="http://www.w3.org/2002/xforms" xmlns="http://www.w3.org/1999/xhtml">     
  <p>        
   <b>           
    <i>This is purchase Order Input.</i>        
   </b>                     
  </p>     
  <p>                      </p>     
  <table border="1">        
   <tr>           
    <td>                        order Id:                    </td>           
    <td>              
     <xforms:output xmlns:po="http://wlmse.sample/po" incremental="true" model="inputModel"
                    ref="po:orderId"/>                               
    </td>                                                
   </tr>        
   <tr>           
    <td>                        product Id:                    </td>           
    <td>              
     <xforms:output xmlns:po="http://wlmse.sample/po" incremental="true" model="inputModel"
                    ref="po:purchaserName"/>                               
    </td>                                                
   </tr>        
   <tr>           
    <td>                        purchaser Name:                    </td>           
    <td>              
     <xforms:output xmlns:po="http://wlmse.sample/po" incremental="true" model="inputModel"
                    ref="po:productId"/>                               
    </td>                                                
   </tr>        
   <tr>           
    <td>                        amount:                    </td>           
    <td>              
     <xforms:output xmlns:po="http://wlmse.sample/po" incremental="true" model="inputModel"
                    ref="po:amount"/>                               
    </td>                                                 
   </tr>                                             
  </table>  
 </xforms:group>
</inputXForm>
<setvalue  xmlns:po="http://wlmse.sample/po"  model="outputModel" ref="instance('output')/po:orderId" >tesdd</setvalue>
  <xforms:output xmlns:po="http://wlmse.sample/po" ref="instance('output')/po:orderId"></xforms:output>
<outputXForm>  
 <xforms:group xmlns:xforms="http://www.w3.org/2002/xforms" xmlns="http://www.w3.org/1999/xhtml">     
  <p>        
   <b>           
    <i>This is purchase Order Output.</i>        
   </b>                         
  </p>     
  <p>        
   <table border="1">           
    <tr>              
     <td>                        Approve:                    </td>              
     <td>                 
      <xforms:select1 xmlns:po="http://wlmse.sample/po" incremental="true" model="outputModel"
                      ref="po:approveResult">                    
       <xforms:label/>                    
       <xforms:item>                       
        <xforms:label>Approved</xforms:label>                       
        <xforms:value>Approved</xforms:value>                                              
       </xforms:item>                    
       <xforms:item>                       
        <xforms:label>Rejected</xforms:label>                       
        <xforms:value>Rejected</xforms:value>                                              
       </xforms:item>                                         
      </xforms:select1>                                  
     </td>                                                   
    </tr>           
    <tr>              
     <td>                        Description:                    </td>              
     <td>                 
      <xforms:textarea xmlns:po="http://wlmse.sample/po" model="outputModel" ref="po:description">                    
       <xforms:label/>                                         
      </xforms:textarea>                                  
     </td>                                                   
    </tr>           
    <tr>              
     <td>                 
          
      
     </td>                                              
    </tr>
    <tr>              
     <td>                 
      <xforms:submit submission="default-submission">                    
       <xforms:label>Submit</xforms:label>         
      
     
         <xforms:action ev:event="DOMActivate">
             <xforms:setvalue  xmlns:po="http://wlmse.sample/po"  model="outputModel" ref="instance('output')/po:orderId" value="instance('input')/po:orderId"></xforms:setvalue>
             <xforms:message level="modal">hell0</xforms:message>
         </xforms:action>
     
      </xforms:submit>                                  
     </td>                                              
    </tr>                  
   </table>                                                                                             
  </p>                                                  
 </xforms:group>
</outputXForm>
</body>
</html>


Ahhh...imagining that irresistible "new car" smell?
Check out new cars at Yahoo! Autos.

--
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
Reply | Threaded
Open this post in threaded view
|

Re: setvalue problem copying data from one instance to another instance

Alessandro Vernet
Administrator
On 4/18/07, ritesh a <[hidden email]> wrote:
> <xforms:setvalue  xmlns:po="http://wlmse.sample/po"  model="outputModel"
> ref="instance('output')/po:orderId"
> value="instance('input')/po:orderId"></xforms:setvalue>

Most likely this is because since you are in "outputModel". The
instance() function only returns intances in the current model, per
the XForms specification. So it won't pick the "input" instance from
the inputModel.

Instead of instance('input')/po:orderId you can use
xxforms:instance('input')/po:orderId which will return the "input"
instance even if it is not in the current model. Or you can just use
one model, and have multiple instances in that model.

Alex
--
Orbeon Forms - Web 2.0 Forms for the Enterprise
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws