conditionally (by user role) display a input OR a dropdown

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

conditionally (by user role) display a input OR a dropdown

Vlad
Hello,

For a certain node value in a instance ,  I'm trying to display an input IF is-user-in role('...') and a dropdown select otherwise.

I tried with <xforms:action if="xxforms:is-user-in-role('...')" ........ /> but it doesn't work , it seems that if has to receive a XSL string , XPath doesn't work.

I also tried this : I created another instance for the user role and gave it a certain value if the user had that role , then tried to put a condition on that instance from xforms:action if - this didn't work either :

<xforms:action if="instance('auth-user-role')">
...
</xforms:action>

I tried more different conditions this one should have returned true only if the instance existed.



Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: conditionally (by user role) display a input OR a dropdown

Erik Bruchez
Administrator
The trick is to do something like:

<xforms:input ref="foo[condition 1]">
  ...
</xforms:input>
<xforms:select ref="foo[condition 2]">
  ...
</xforms:select>

When a condition is false, the binding becomes empty, and the control
becomes hidden.

-Erik

On Sat, Jul 21, 2012 at 4:44 AM, Vlad <[hidden email]> wrote:

> Hello,
>
> For a certain node value in a instance ,  I'm trying to display an input IF
> is-user-in role('...') and a dropdown select otherwise.
>
> I tried with *<xforms:action if="xxforms:is-user-in-role('...')" ........
> />* but it doesn't work , it seems that *if* has to receive a XSL string ,
> XPath doesn't work.
>
> I also tried this : I created another instance for the user role and gave it
> a certain value if the user had that role , then tried to put a condition on
> that instance from xforms:action if - this didn't work either :
>
> <xforms:action if="instance('auth-user-role')">
> ...
> </xforms:action>
>
> I tried more different conditions this one should have returned true only if
> the instance existed.
>
>
>
> Thanks.
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/conditionally-by-user-role-display-a-input-OR-a-dropdown-tp4655527.html
> Sent from the Orbeon Forms (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
>


--
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: conditionally (by user role) display a input OR a dropdown

Vlad
Thanks , it works !