XPath Expression in value attribute of xforms:setvalue

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

XPath Expression in value attribute of xforms:setvalue

Phani S
Hi all,
       I had an instance called  
<instance xmlns="">
  <record>
  <selected>false</selected>
  </record>
  <record>
  <selected>false</selected>
  </record>
  <record>
  <selected>false</selected>
  </record>
  </instance>
I want to change this value when ever I click a button.
   <xforms:trigger appearance="minimal" id="confirm-delete-trigger">
  <xforms:label>Select</xforms:label>
  <xforms:action ev:event="DOMActivate">
  <xforms:setvalue ref="selected" value="if(selected='true') then 'false' else 'true'"/>
  <xforms:send submission="select"/>
  </xforms:action>
  </xforms:trigger>

its value is changing for the first time only. how do i repeatedly change the value between true and false by clicking select button.

--
Phani. S
M.Tech(Software Engineering)
Motilal Nehru National Institute of Technology
(+91) 9010093398


--
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: XPath Expression in value attribute of xforms:setvalue

Philip.Cantin
Phani,

When you use the 'ref' attribute in <xforms:setvalue>, it already puts you within the context of the <selected> element in your instance. Since there is no additional <selected> element within your <selected> elements, the first part of the if statement fails, and thus it is set to 'true' the first time but is not changed back to 'false' after that. This is where the "." XPath operator helps, to refer to the current node.

I'll bet if you change your <xforms:setvalue> markup to:


<xforms:setvalue ref="selected" value="if(. = 'true') then 'false'
else 'true'"/>


it will work just fine! And let me know if anything I said is unclear, or if what I said doesn't work.


--Philip



Phani Sajja wrote
Hi all,
       I had an instance called
<instance xmlns="">
  <record>
  <selected>false</selected>
  </record>
  <record>
  <selected>false</selected>
  </record>
  <record>
  <selected>false</selected>
  </record>
  </instance>
I want to change this value when ever I click a button.
   <xforms:trigger appearance="minimal" id="confirm-delete-trigger">
  <xforms:label>Select</xforms:label>
  <xforms:action ev:event="DOMActivate">
  <xforms:setvalue ref="selected" value="if(selected='true') then 'false'
else 'true'"/>
  <xforms:send submission="select"/>
  </xforms:action>
  </xforms:trigger>

its value is changing for the first time only. how do i repeatedly change
the value between true and false by clicking select button.

--
Phani. S
M.Tech(Software Engineering)
Motilal Nehru National Institute of Technology
(+91) 9010093398


--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: XPath Expression in value attribute of xforms:setvalue

Phani S
thanks Philip,
                it worked perfectly for me. thanks for your help.

On Sat, Jul 18, 2009 at 12:04 AM, Philip.Cantin <[hidden email]> wrote:

Phani,

When you use the 'ref' attribute in <xforms:setvalue>, it already puts you
within the context of the <selected> element in your instance. Since there
is no additional <selected> element within your <selected> elements, the
first part of the if statement fails, and thus it is set to 'true' the first
time but is not changed back to 'false' after that. This is where the "."
XPath operator helps, to refer to the current node.

I'll bet if you change your <xforms:setvalue> markup to:


<xforms:setvalue ref="selected" value="if(. = 'true') then 'false'
else 'true'"/>


it will work just fine! And let me know if anything I said is unclear, or if
what I said doesn't work.


--Philip




Phani Sajja wrote:
>
> Hi all,
>        I had an instance called
> <instance xmlns="">
>   <record>
>   <selected>false</selected>
>   </record>
>   <record>
>   <selected>false</selected>
>   </record>
>   <record>
>   <selected>false</selected>
>   </record>
>   </instance>
> I want to change this value when ever I click a button.
>    <xforms:trigger appearance="minimal" id="confirm-delete-trigger">
>   <xforms:label>Select</xforms:label>
>   <xforms:action ev:event="DOMActivate">
>   <xforms:setvalue ref="selected" value="if(selected='true') then 'false'
> else 'true'"/>
>   <xforms:send submission="select"/>
>   </xforms:action>
>   </xforms:trigger>
>
> its value is changing for the first time only. how do i repeatedly change
> the value between true and false by clicking select button.
>
> --
> Phani. S
> M.Tech(Software Engineering)
> Motilal Nehru National Institute of Technology
> (+91) 9010093398
>
>
> --
> 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
>
>

--
View this message in context: http://www.nabble.com/XPath-Expression-in-value-attribute-of-xforms%3Asetvalue-tp24529009p24539586.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




--
Phani. S
M.Tech(Software Engineering)
Motilal Nehru National Institute of Technology
(+91) 9010093398


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