JQuery to change the width of a mulitvalued lookup field in SharePoint and to hide the Workspace field in an event list.
The script to change the width of multivalued lookup fields:
<script type="text/javascript">
$(document).ready(function()
{
$("select[id*='<INSERT_YOUR_FIELDNAME>']").parent().width(300);
$("select[id*='<INSERT_YOUR_FIELDNAME>']").parent().height(200);
$("select[id*='<INSERT_YOUR_FIELDNAME>']").width(300);
});
</script>
The script to hide the workspace checkbox in an event list:
This first bit of script hides the ‘Workspace’checkbox in the NewForm and the EditForm. The script to hide the workspace field from the DispForm.aspx:
<script type="text/javascript">
$(document).ready(function()
{
$("a[name='SPBookmark_WorkspaceLink']").parent().parent().parent().hide();
});
</script>
<script type="text/javascript">
$(document).ready(function()
{
$("a[name='SPBookmark_WorkspaceLink']").parent().parent().parent().hide();
});
</script>There are several ways to add the script to the pages. For the Lookup fields I used the I descibe in this blog post. For the Event list, I created custom EditForm, NewForm and DispForm pages and added the script to those pages directly.
If you have better solution, just tell me !
0 comments:
Post a Comment