How can I Disable/Hide a control based on the user?? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

How can I Disable/Hide a control based on the user??

Last post 08-16-2011 07:00 AM by jaybranch. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-10-2011 07:02 AM

    How can I Disable/Hide a control based on the user??

    Hi all,

    On my Purchase Req form, the management team have requested that my approval control (drop down list) be hidden/disabled from a user IF that user has created the form originally.

    In other words, they don't wish users to raise AND approve their own forms.  So, if manager Steve raises his form, he shouldn't be allowed to approve it aswell.  It should be submitted FAO another manager and he/she should approve it instead. 

    Could I do this using a rule?  If so, how do I do it?

    There are only a small number of people who can see the approval control as it is on the form.... 'normal' users can't, as they simply submit their form and their manager approves it.  But, managers could raise their own form and approve it if they wished.  We just need to get them to send their form to another manager for approval. 

    Any help would be appreciated!

    Thanks

    James

    Filed under:
  • 08-14-2011 03:48 PM In reply to

    Re: How can I Disable/Hide a control based on the user??

    Hi James,

    sure, you can do this with rules only.

    First of all you have to get the current user name. This can be done with the userName() function in the 'Default value' field of a textbox. The checkbox 'Refresh value when formula is recalculated' must be deactivated. Then you need a second textbox with the same function in the default value. Here you should set the checkbox 'Refresh... active. Now you set a rule on the approval control that this control will be hidden or disabled when textbox1 is identical to textbox 2.

    Hope that helps.

    Regards,
    Karsten 

    Karsten
  • 08-16-2011 07:00 AM In reply to

    Re: How can I Disable/Hide a control based on the user??

    Karsten,

    Excellent - why didn't I think of that!  I already use the username() function on one of my fields, plus I have another box (hidden) at the bottom which gives the same info, but it changes as it also changes other fields on the form, depending on which user opens the form.

    So, I've created the rule and it seems to work fine - thanks for the tip!!   :)

     

    Best regards

    James

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.