How often will calculate works in Orbeon Xforms
I have a bind definition as follows:
<xforms:bind nodeset="instance('demo')/pointer"
type="xforms:integer"
calculate="
if($current-page < '2') then '0'
else (
if($current-page > '2')
then ($max-pages - 1)
else .
)"/>
For every user click on the form, the current-page
value changes. I wanted to understand how often does the calculate in the above the bind defnition execute?
The problem is that the pointer
variable and current-page
are dependent on each other, so if I click on something first, the value of pointer
should be 开发者_Go百科evaluated immediately and in the next instruction I have to set the current-page
value based on the pointer value that is changed. On the click, the code will be as below:
<xforms:setvalue ref="$pointer"
value="($pointer + 1)"/>
<!-- i am assuming if the current-page is 2,
it will increment, else the value is set as per calculate -->
<xforms:setvalue ref="$current-page"
value="($current-page + 1)"
xxforms:if="($pointer = $max-pages)" />
- When users click on the button (assuming it is a button) that trigger the two
xforms:setvalue
, thosexforms:setvalue
run first and thexforms:bind calculate
runs later. - Pretty much all users' interaction with the form will cause the
xforms:bind calculate
to be be reevaluated.
精彩评论