Calling a script based on the instance value.......

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

Calling a script based on the instance value.......

Sathish K Mittapelli


Hai All,

 

I am trying to call  a particular script in my code in a trigger DOMActivate event based on the test attibute..as like this

 

<xforms:trigger ref="instance('triggers')/editbutton">

<xforms:label>Edit Employee</xforms:label>

<xforms:action ev:event="DOMActivate">

<xxforms:choose>

<xxforms:when test="count(instance('main')/employee/select['true']) &gt; 1">

<xxforms:script >

edit();

</xxforms:script>

<xforms:toggle case="display"/>

</xxforms:when>

<xxforms:otherwise>

<xforms:toggle case="edit"/>

</xxforms:otherwise>

</xxforms:choose>

.....

...

But i am getting error like invalid data element xxform:choose..........As i realised that xxforms:choose and xxforms:when are depricated by Orbeon.....Is there any alternatives to achieve my Requirement...........

THANKS & REGARDS
SATHISH K MITTAPELLI  


Has your work life balance shifted? Find out.

--
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: Calling a script based on the instance value.......

fl.schmitt(ops-users)
hi sathish,

> I am trying to call  a particular script in my code in a trigger
> DOMActivate event based on the test attibute..as like this (...)

you could use the xforms:group element. In your case, you could use the
following structure:

<xforms:group ref=".[condition1]">
     <xforms:trigger>
         ....
     </xforms:trigger>
</xforms:group>
<xforms:group ref=".[condition2]">
     <xforms:trigger>
         ....
     </xforms:trigger>
</xforms:group>

where condition1 is
count(instance('main')/employee/select['true']) gt 1
and condition2 is
count(instance('main')/employee/select['true']) le 1

The xforms:toggle has to be replaced, then, by a xforms:setvalue, i think.


Maybe, you could alternatively use xforms:switch with two xforms:case
elements. Here, too, each case would contain one xforms:trigger. This
way, you could use xforms:toggle. But i didn't test it...


A third possibility would be to put the if-else structure into the
javascript code. For this, you need only one trigger without
xforms:group or xforms:case. The value of the toggling instance element
has to be read in by the javascript:

var value = ORBEON.xforms.Document.getValue("value");
if (value > 1){
     doSomething
} else {
     doSomethingElse
};
ORBEON.xforms.Document.setValue("value", newValue);


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