Sorry Another Newbie Question/Issue on setvalue

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

Sorry Another Newbie Question/Issue on setvalue

Martin Conway (mconway)
Hi all,
 
Am struggling to get setvalue to assign a value to an attribute.  I can use insert to get a new node into the instance, however, the setvalue function does not seem to update the attribute.
 
I use the following trigger:-
 
            <xforms:trigger appearance="minimal">
              <xforms:insert ev:event="DOMActivate" nodeset="/Project/Resources/Resource"
               at="1" position="before" origin="instance('Resource-Template')"/>
              <xforms:setvalue ref="/Project/Resources/Resource[1]/@belong-type" value="Customer"/>
               <xforms:label>
                Add<img src="../apps/xforms-bookcast/images/add.gif"/>
               </xforms:label>
            </xforms:trigger>
 
I have the following instances.
 
             <xforms:instance id="Project-Instance">
                <Project xmlns="">
                   <ProjectName/>
                   <CustomerName/>
                   <ProjectId/>
                   <Companies>
                      <Company>
                          <Name>Cisco</Name>
                      </Company>
                       <Company>
                          <Name>Another</Name>
                       </Company>
                    <Company>
                        <Name>Mine</Name>
                    </Company>
                   </Companies>
                   <Resources>
                        <Resource belong-type="Customer">
                             <Name>Martin</Name>
                              <Company>Cisco</Company>
                              <Role>worker</Role>
                              <Email>[hidden email]</Email>
                              <Phone>999</Phone>
                       </Resource>
                   </Resources>
                </Project>
            </xforms:instance>

     <xforms:instance id="Resource-Template">
                <Resource belong-type="" xmlns="">
                  <Name></Name>
                  <Company></Company>
                  <Role></Role>
                  <Email></Email>
                  <Phone></Phone>
                </Resource>
            </xforms:instance>
        </xforms:model>
 
After the trigger the attribute remains unset:-
 
<Resource belong-type="">
  <Name/>
  <Company/>
  <Role/>
   <Email/>
  <Phone/>
</Resource>
 
Am I missing something really obvious here ?
 
Thanks In Advance
 
Martin


--
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: Sorry Another Newbie Question/Issue on setvalue

Brian_Steuhl

newbie myself but try:

 

<xforms:setvalue ref="instance('Project-Instance')/Resources/Resource[1]@belong-type" value="Customer"/>



--
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: Sorry Another Newbie Question/Issue on setvalue

fl.schmitt(ops-users)
In reply to this post by Martin Conway (mconway)
Martin,

> I use the following trigger:-
>  
> <xforms:trigger appearance="minimal">
>     <xforms:insert
 >         ev:event="DOMActivate"
 >         nodeset="/Project/Resources/Resource"
>         at="1"
 >         position="before"
>         origin="instance('Resource-Template')"/>
>    <xforms:setvalue
 >         ref="/Project/Resources/Resource[1]/@belong-type" value="Customer"/>
>    <xforms:label>
>        Add<img src="../apps/xforms-bookcast/images/add.gif"/>
>    </xforms:label>
> </xforms:trigger>

i didn't test it, but i think you'll have to
- either add an ev:event attribut to the xforms:setvalue, too,
- or put both the xforms:insert and the xforms:setvalue into an xforms:action
and add the ev:event to the xforms:action.

HTH
florian


--
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: Sorry Another Newbie Question/Issue on setvalue

Martin Conway (mconway)
Doh!!

I missed the ev:event specification from the setvalue. Just put it in
and things work perfectly.

Thanks to both Florian and Brian for your help.

Martin

-----Original Message-----
From: Florian Schmitt [mailto:[hidden email]] On Behalf Of
Florian Schmitt
Sent: 13 July 2008 14:46
To: [hidden email]
Subject: [ops-users] Re: Sorry Another Newbie Question/Issue on setvalue

Martin,

> I use the following trigger:-
>  
> <xforms:trigger appearance="minimal">
>     <xforms:insert
 >         ev:event="DOMActivate"
 >         nodeset="/Project/Resources/Resource"
>         at="1"
 >         position="before"
>         origin="instance('Resource-Template')"/>
>    <xforms:setvalue
 >         ref="/Project/Resources/Resource[1]/@belong-type"
value="Customer"/>
>    <xforms:label>
>        Add<img src="../apps/xforms-bookcast/images/add.gif"/>
>    </xforms:label>
> </xforms:trigger>

i didn't test it, but i think you'll have to
- either add an ev:event attribut to the xforms:setvalue, too,
- or put both the xforms:insert and the xforms:setvalue into an
xforms:action and add the ev:event to the xforms:action.

HTH
florian


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