enable edit button for admin user

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

enable edit button for admin user

rameshkancherla
Hi,
     This is ramesh. I am implementing orbeon xform in my application. I have to do enable edit button for admin user only. if normal user login i have to disable the edit button.

      I have seen in examples as if relevant attribute is false then button will be in disable mode.
but it is not working for me.


          <xf:instance  id="term">
               <data xmlns="">
                <info>
                   <admin-name>false</admin-name>
                  </info>
                 </data>
              </xf:instance> 
    <xf:bind id="one" nodeset="/data/info/admin-name" relevant="instance('term')/info/admin-name"/>

      <xf:trigger bind="one">
          <xf:label>edit</xf:label>
        </xf:trigger >


can any one please give me suggestion how can i do it



Thanks & Regards
Ramesh k

           
Reply | Threaded
Open this post in threaded view
|

Re: enable edit button for admin user

venkata subrahmanyam
Hi Ramesh,

Your problem can be solved as
1) <xf:group ref=".[instance('term')/info/admin-name]">
            <xf:trigger >
          <xf:label>edit</xf:label>
        </xf:trigger >
          </xf:group>
or
2) you can keep another tag <isadmint>true</isadmin>  or false to that node and try with bind or <xf:group ref=".[instance('term')/info/isadmin ='true']">
            <xf:trigger >
          <xf:label>edit</xf:label>
        </xf:trigger >
 </xf:group>

Reply | Threaded
Open this post in threaded view
|

Re: enable edit button for admin user

rameshkancherla
Thanks for your replay.
             I got it with second option

Thanks
Ramesh k

subrahmanyam wrote
Hi Ramesh,

Your problem can be solved as
1) <xf:group ref=".[instance('term')/info/admin-name]">
            <xf:trigger >
          <xf:label>edit</xf:label>
        </xf:trigger >
          </xf:group>
or
2) you can keep another tag <isadmint>true</isadmin>  or false to that node and try with bind or <xf:group ref=".[instance('term')/info/isadmin ='true']">
            <xf:trigger >
          <xf:label>edit</xf:label>
        </xf:trigger >
 </xf:group>
Reply | Threaded
Open this post in threaded view
|

Re: enable edit button for admin user

David McIntyre
In reply to this post by rameshkancherla
Hi Ramesh,

Just a couple of things.  If the relevant attribute is false then the button will not show at all - if you want the button visible but disabled then what you need is to set the readonly attribute to true.  What is really giving you a problem, though, is that the relevant attribute in the bind is not treating the string value "false" as a boolean false.  Basically, as long as there is a node at the location the path points to, then the value is interpreted as a boolean true.  There are various things you can do to fix that, some of which don't work quite as well as you might hope.  In the end the one I would probably use is

<xf:bind id="one" nodeset="instance('term')/info/admin-name" relevant=". = 'true'"/>
An alternative to try would be add a type="xs:boolean" attribute in the bind, or to cast the value to a boolean.  Another option is to not bother with a bind and relevance, but just add a ref attribute to the trigger itself which points to a non-existant location when you want the button to be hidden ... something like

      <xf:trigger ref="instance('term')/info/admin-name[. = 'true']">
	  <xf:label>edit</xf:label>
	</xf:trigger >


Hope this helps.

Dave

rameshkancherla wrote:
Hi,
     This is ramesh. I am implementing orbeon xform in my application. I
have to do enable edit button for admin user only. if normal user login i
have to disable the edit button.

      I have seen in examples as if relevant attribute is false then button
will be in disable mode.
but it is not working for me.


          <xf:instance  id="term">
               <data xmlns="">
                <info>
                   <admin-name>false</admin-name>
                  </info>
                 </data>
              </xf:instance> 
    <xf:bind id="one" nodeset="/data/info/admin-name"
relevant="instance('term')/info/admin-name"/>

      <xf:trigger bind="one">
	  <xf:label>edit</xf:label>
	</xf:trigger >


can any one please give me suggestion how can i do it



Thanks & Regards
Ramesh k

           
  

--
Orion Signature

Dave McIntyreSoftware Developer
[hidden email]
P: +64 9 638 0600
M: +64 21 123 456
F: +64 9 638 0699
S: <a href="callto:dave.mcintyre">dave.mcintyre
www.orionhealth.com


This e-mail and any attachments are intended only for the person to whom it is addressed and may contain privileged, proprietary, or other data protected from disclosure under applicable law. If you are not the addressee or the person responsible for delivering this to the addressee you are hereby notified that reading, copying or distributing this transmission is prohibited. If you have received this e-mail in error, please telephone us immediately and remove all copies of it from your system. Thank you for your co-operation.


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