Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a multi lookup just like this image, with 2 listboxes and Add and Remove buttons:

http://mastykarz.nl/blog/images/ExtendingLookupFieldswithAddnewitemoptio_6981/SingleMultipleLookupFields_thumb.png

The problem is that the buttons are too long. I have tried to shorten them with jQuery, but it seems Sharepoint somehow overrides my setting and/or does not allow it.

I'm probably missing something obvious, but is there a way to alter the size of the Add/Remove buttons in such a control?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The following JavaScript function could be used for customizing control for SPFieldMultiLookup

//Specify width for Add & Remove buttons in SPFieldMultiLookup control
function customizeMultiLookupField()
{ 
    var j = jQuery.noConflict();   
    j('button[id$="_AddButton"]').css('width','72px');
    j('button[id$="_RemoveButton"]').css('width','72px');
}

Usage:

Save specified function in JS file and place it in Layouts folder.

Reference it in NewForm.aspx page and call it:

_spBodyOnLoadFunctionNames.push("customizeMultiLookupField");
share|improve this answer
    
Thank you so much. I really thought there is an obvious solution, like changing some property value in Sharepoint Designer or somewhere. But it seems jQuery is the solution in most cases. Thank you –  Amc_rtty Feb 7 '13 at 16:10
    
Thank you! Your solution works like a charm. Where do you know the control IDs like '_AddButton' and '_RemoveButton'? I need to change the size from both Listboxes. Where or how can I find information about the IDs? Best Regards Patrick. –  user17297 May 29 '13 at 7:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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