locked
Create DropDown box with various values disabled or unavailable due to current user RRS feed

  • Question

  • I would like to create a form that has a dropdown box with values A, B, C, D.  If User1 visits the form, they only see B, D but if user2 visits the form they see all 4 options in the dropdown.  Is this possible in a browser enabled infopath form?

    Wednesday, March 2, 2011 2:42 PM

Answers

All replies

  • A trick around not being able to filter in broswer enabled is to add this control twice on your form (bound to the same datasource) - an easy way is just copy and paste it directly below the original control.  Change the properties to one of the controls to only show B, D.  In the other dropdown put all of the selection (A, B, C, D).  Now, apply conditional formatting to the first dropdown that says if username is equal to User2 hide this control.  Then on the second dropdown apply conditional formatting that says if username is equal to user1 hide this control.
    Wednesday, March 2, 2011 5:13 PM
  • Brilliant!!!  I'll let you know how it works.
    Wednesday, March 2, 2011 7:28 PM
  • Actually, I'm unsure of how to apply conditional formatting to hide one of the controls.
    Wednesday, March 2, 2011 8:44 PM
  • Right Click the dropdown > Conditional Formatting > Add

    Can you be more specific on who gets to see what so I can help you with the condition?  (i.e. which users get to see what - are you looking for specific user names, etc.?)

    Wednesday, March 2, 2011 8:47 PM
  • Conditional Formatting isn't listed there.  I'm using InfoPath 2010 if that makes a difference.  You explanation made perfect sense to me, I just don't see how to get myself started in the right direction.

    Wednesday, March 2, 2011 9:17 PM
  • Ohh I see... (you're in the pre 2010 forum so I assumed you're using 2007).  A quick google search on InfoPath 2010 conditional formatting found this answer from Clayton Cobb:

    "Conditional formatting is a rule.  We no longer have to go to separate places for conditional formatting, data validation, and action rules.  It's all managed in in the Manage Rules pane, and they can all now be copied/pasted to other controls."

    Wednesday, March 2, 2011 9:21 PM
  • Yes, I found the Hide control functionality, however when I change the options in one control, it automatically changes the options for the other control as they are named the same and linked to the same source data.

     

    Wednesday, March 2, 2011 9:33 PM
  • Darn, that would be a problem with changing where conditional formatting is stored in 2010 wouldn't it be.... ok... Another idea, along the same concept... add another dropdown control that is bound to a separate field.  Then use a rule to update the value of the actual datasource to the selection from the new dropdown.
    Wednesday, March 2, 2011 9:35 PM
  • Hi,

    Place each drop down box in a separate Optional Section and then apply conditional formating to these optional sections. For example : If Drop Down Box 1 is in First optional section then apply conditional formating to hide it from the respective users. Similarly you can do with other optional sections.

    You have to apply conditional formating to the optional sections rather than the drop down boxes as all the drop down boxes will be inside optional sections.

    Regards

    Ginni - Microsoft Community Contributor

    [My SharePoint Blog]

    Thursday, March 3, 2011 4:44 AM
  • Christopher:

    I had a requirement that is similar to this.  I used a SharePoint list to hold the values available from the dropdown (I had 20,000 items, so i had to store them in a list) but the solution still applies.

    The list had 2 columns.  The first column was the dropdrown option (A, B, C, D...).  The second column was a Person column that held the name of the person(s) who can see that dropdown item.

    Because InfoPath will only receive the items displayed in the default view of the list, i created a new view, set it as the default view, and filtered the view to show only those items where the name in the Person field = [Me].

    Now create a data connection to the list and set that data connection as the source for the dropdown.

    A benefit to this approach is that you dont have to modify the form to change who has access to what.

    Hope this helps

    Ed

    Thursday, March 3, 2011 4:20 PM
  • Ed,

    I tried this.  I have the view setup and it's displaying appropriately, and I've linked the dropdown to the Data Connection which is to the List, but when previewing the form it's still showing the entire list of incidents.  I'm not sure where I went wrong.

    Thursday, March 3, 2011 8:21 PM
  • Did you make the new view the default view for the list? 

    Unless there is something new in IP 2010 (thought you were on IP 2007).  The dropdown should only show you the items that are visible when you view the list in SharePoint.

    Thursday, March 3, 2011 9:02 PM
  • Yes, I made it the default view.  The strange part, is that there are duplicate fields in the first column of the List, as a few options are available to multiple people, but the duplicates aren't showing up in the dropdown, and I don't have the "Show only entries with unique display names" checked in the dropdown list properties.

     

    Thursday, March 3, 2011 9:35 PM
  • I apologize.....it IS showing the duplicates in there I just didn't notice it.  It's as though the form isn't recognizing there's a default view on the list though.

    Thursday, March 3, 2011 9:38 PM
  • OMG!!!!  I got it to work!!!  I'm so excited!!! Thanks to Peter.Stilgoe  http://www.petestilgoe.com/2010/07/populating-an-infopath-dropdown-using-a-specific-sharepoint-list-view/
    • Marked as answer by TopherMM Thursday, March 3, 2011 10:04 PM
    Thursday, March 3, 2011 10:03 PM