Disable buttons depending on UserName - InfoPath Dev
in

InfoPath Dev

Disable buttons depending on UserName

Last post 02-13-2013 06:33 AM by ferrominera. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-08-2013 05:03 PM

    Disable buttons depending on UserName

    I have a form that has 2 buttons. One of them I want to restrict access to to certain individuals. In all other cases it needs to be grayed out (disabled).

    What I have done is create a rule that compares the UserName of the current user to certain names that are of the people I want to grant access to. For some reason that I cannot figure out, the button is grayed out if I have that rule. Let me be more specific (I may give more info than needed, just trying to be throurough).

    The button in question submits the form and I defined it as a Action Rules button. The rule I am running intends to change the formatting (i.e.disable the button) depending on whether the Current user is not John Smith or Jane.Doe. This is how I write the condition:

    Current User does not contain "Smith" AND

    Current User does not contain "Doe"

    Current User is a textbox that has the UserName formula.

    It is not working. I made the Current User texbox visible on the form and in fact it is showing the name of the current user, so the comparison should be straightforward.

    I'm not sure it makes any difference, but this is a form connected to a list and John Smith and Jane Doe do not have full access to delete stuff. If I remove the rule they do have access to the button.

    Any tip will be greatly appreciated.

    Filed under: ,
  • 02-09-2013 03:57 PM In reply to

    Re: Disable buttons depending on UserName

    Hi Ferrominera,

    Maybe it's because there's case difference. The comparison is case sensitive, so if the username is returning all lower case "smith" and your rule is comparing against "Smith" it will fail. To solve this, you want to use the translate function. Search this forum for "translate case" and you'll find some examples of functions, but it's easy - just use translate('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') and make sure the comparison value is also lower case.

    If that doesn't work, let us know.

    Patrick Halstead
    Project Manager at Qdabra
  • 02-13-2013 06:33 AM In reply to

    Re: Disable buttons depending on UserName

    Actually I think the problem is that I was trying to declare a format validation for the button using one of the limitations within the button's properties. Let me explain: as noted above, I was putting the "does not contain "Smith"" rule within the button. The validation was not working. Now, when the validation is between two fields outside of the button, it works. For example, disable is Current user does not contain Name (name being a field I created where I put the name of the person I want to validate).

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