Member_2_4484036
asked on
Sharepoint 2007: How do I modify width of Multiple Select boxes
Is it possible in Sharepoint 2007 to modify the multiple select boxes to increase their widths? We have various multiple select boxes, Content Columns that are used to describe files being upload.
Is this possible without modifying the core code of Sharepoint to have the widths of these boxes expanded? I am presuming this would be done somewhere within the template area but I am unsure how. Currently the width is 143px.
We're trying to increase the width of these multple select boxes on the EditForm.aspx page.
Any help or advice is greatily apprecaited.
Is this possible without modifying the core code of Sharepoint to have the widths of these boxes expanded? I am presuming this would be done somewhere within the template area but I am unsure how. Currently the width is 143px.
We're trying to increase the width of these multple select boxes on the EditForm.aspx page.
Any help or advice is greatily apprecaited.
Can you show me the code. Does it resize based on select items ? You can do it in CSS
Give your selects a ID or a CLASS name
<select name="select1" class="sel1">
....
</select>
<select name="select2" class="sel2">
....
</select>
Then reference them in your css
<style type="text/css">
<!--
.sel1{
width: 200px;
background: #ff0000;
color: #ffffff;
}
.sel2{
width: 200px;
background: #ff0000;
color: #ffffff;
}
// -->
</style>
<select name="select1" class="sel1">
....
</select>
<select name="select2" class="sel2">
....
</select>
Then reference them in your css
<style type="text/css">
<!--
.sel1{
width: 200px;
background: #ff0000;
color: #ffffff;
}
.sel2{
width: 200px;
background: #ff0000;
color: #ffffff;
}
// -->
</style>
ASKER
Here's a sample
<div style='width:143px;height:125px;overflow:scroll'><select name="ctl00$m$g_01c3523a_a1dd_40be_860a_8312dfdc9130$ctl00$ctl02$ctl00$ctl01$ctl00$ctl00$ctl07$ctl00$ctl00$ctl04$ctl00$ctl00$SelectCandidate" id="ctl00_m_g_01c3523a_a1dd_40be_860a_8312dfdc9130_ctl00_ctl02_ctl00_ctl01_ctl00_ctl00_ctl07_ctl00_ctl00_ctl04_ctl00_ctl00_SelectCandidate" multiple="multiple" title="Primary research method possible values" onchange="GipSelectCandidateItems(ctl00_m_g_01c3523a_a1dd_40be_860a_8312dfdc9130_ctl00_ctl02_ctl00_ctl01_ctl00_ctl00_ctl07_ctl00_ctl00_ctl04_ctl00_ctl00_MultiLookupPicker_m);" ondblclick="GipAddSelectedItems(ctl00_m_g_01c3523a_a1dd_40be_860a_8312dfdc9130_ctl00_ctl02_ctl00_ctl01_ctl00_ctl00_ctl07_ctl00_ctl00_ctl04_ctl00_ctl00_MultiLookupPicker_m); return false" onKeyDown="GipHandleHScroll(event)">
</select></div>
ASKER
The boxes are generated by Sharepoint so I can't control the ID.
I guess it uses some CSS automatically thats what thsi link says.http://blogs.msdn.com/sharepointdesigner/archive/2007/11/09/an-introduction-to-conditional-formatting.aspx
Check that and change as I mentioned.
Sorry I dont haev sharepoint installed here
Check that and change as I mentioned.
Sorry I dont haev sharepoint installed here
ASKER
jitganguly,
I appreciate your help but don't understand your last post, can you please elaborate?
I appreciate your help but don't understand your last post, can you please elaborate?
All I wanted to say was , check whic css it uses and then use the example I provided on my first post to change the size
ASKER
This part of the page doesn't use CSS, it hard codes the style right in the DIV (see code above).
Ok then why not use this
style="width: 200px;"
or change it to whatever size that fits
<div style='width:143px;height: 125px;over flow:scrol l'><select style="width: 200px;"name="ctl00$m$g_01c 3523a_a1dd _40be_860a _8312dfdc9 130$ctl00$ ctl02$ctl0 0$ctl01$ct l00$ctl00$ ctl07$ctl0 0$ctl00$ct l04$ctl00$ ctl00$Sele ctCandidat e" id="ctl00_m_g_01c3523a_a1d d_40be_860 a_8312dfdc 9130_ctl00 _ctl02_ctl 00_ctl01_c tl00_ctl00 _ctl07_ctl 00_ctl00_c tl04_ctl00 _ctl00_Sel ectCandida te" multiple="multiple" title="Primary research method possible values" onchange="GipSelectCandida teItems(ct l00_m_g_01 c3523a_a1d d_40be_860 a_8312dfdc 9130_ctl00 _ctl02_ctl 00_ctl01_c tl00_ctl00 _ctl07_ctl 00_ctl00_c tl04_ctl00 _ctl00_Mul tiLookupPi cker_m);" ondblclick="GipAddSelected Items(ctl0 0_m_g_01c3 523a_a1dd_ 40be_860a_ 8312dfdc91 30_ctl00_c tl02_ctl00 _ctl01_ctl 00_ctl00_c tl07_ctl00 _ctl00_ctl 04_ctl00_c tl00_Multi LookupPick er_m); return false" onKeyDown="GipHandleHScrol l(event)">
</select></div>
style="width: 200px;"
or change it to whatever size that fits
<div style='width:143px;height:
</select></div>
ASKER
Right, that would be great but the problem is the div is automatically generated by Sharepoint and we can neither find the code for where it's generated in 2007, but any changes we'd tried to make to the CSS file have not taken (we were able to modify the width the single drop downs, but not the multiple drop downs). So we are hoping we could use Javascript to resize the items on the front client end. This way we wouldn't have to modify the Sharepoint code drastically.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ironhide1975
Are you able to let me know how you have put your above script into the aspx page to get this working?
I have created my own newform.aspx for a Sharepoint list. I have tried your Javascript in a few different forms in the page but am getting the error 'This Web Part does not have a valid XSLT stylesheet: Error; A name contained an invalid character, for (var i=0; i<elements.length; i++){'
I don't really have much experience with this but need to change the width of the Multi Lookup Picker on the Sharepoint forms so any advice you can give would be much appreciated.
Thanks,
Phil
Are you able to let me know how you have put your above script into the aspx page to get this working?
I have created my own newform.aspx for a Sharepoint list. I have tried your Javascript in a few different forms in the page but am getting the error 'This Web Part does not have a valid XSLT stylesheet: Error; A name contained an invalid character, for (var i=0; i<elements.length; i++){'
I don't really have much experience with this but need to change the width of the Multi Lookup Picker on the Sharepoint forms so any advice you can give would be much appreciated.
Thanks,
Phil
</script> <script type="text/javascript">
function MultiWidth()
var elements = document.getElementsByTagName("div");
for (var i=0; i<elements.length; i++){
if (elements[i].style.width == "143px")elements[i].style.width = "400px";
}
</script>