3

I imagine this isn't possible, but is there any way to remove or override the User type pick-list that shows up when User look-up field is associated with an apex:inputField? See screen cap:

User type pick-list

I'm asking because 1. a standard user will always be selected and 2. real-estate on this page is a little tight and I'd like to trim where possible.

2

Going through the attribute list for apex:inputField, I don't see anything that looks like it'll help.

Here's what I suggest: (if using Chrome) right-click and select Inspect Element over the User-type picklist, and see if there's a specific class attached to that element. Then using jQuery, in your .ready function, hide all elements of that class. Hopefully, the class name for user-type picklists is unique, so it won't bother any other part of the page.

Example: If the class name for user-type picklists = "userType", have the following jQuery

<apex:includeScript value="{!URLFOR($Resource.jQuery)}"/>
<script>
    var j$ = jQuery.noConflict();

    j$(document).ready(function(){
        j$('.userType').hide(); 
    });

</script>
4
  • Thanks, I appreciate the feedback and code snippet. I figured I could use jQuery to manually target those pick-list fields and hide them, but I was asking more-so from a Salesforce perspective if it there's some "hack" we can put in the VF element attributes, or something else that can be written into the page controller, etc. I'll give this a whirl though. Thanks again!
    – kbentsen
    Feb 20 '14 at 21:15
  • they might add an attribute in the future to help with this issue, but going through the attributes currently available, I don't see anything that could be useful. Feb 20 '14 at 21:19
  • you can always use your own HTML inputs, but then you lose (or have to create-on-your-own) the lookup. really, I think the jQuery solution is easiest to implement Feb 20 '14 at 21:20
  • I'm just being extremely lazy and wanted to avoid writing three simple lines of jQuery! :] Unfortunately Visualforce doesn't assign the select field a CSS class, but though the markup does give it an Id ending in mlktp, so I changed the hide line to: $j("[id$=mlktp]").hide();
    – kbentsen
    Feb 20 '14 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.