Important notice

Please note that this blog is discontinued here. All the posts are also coppied to my new blog at http://boris.gomiunik.net.
Important: Due to large amount of comment spam further commenting has been disabled here. If you wish to send me a comment, plase look up the same post on my new blog and leave comment there. Thanks!

9/13/2006

Width of Rich text field in the form

I'm probably one of the biggest fans of SharePoint, because it enables me to do virtually anything with a bit of creativity. So you can expect some more of the SharePoint stuff here (by the way: I'm not a programmer, so don't catch me on too technical details.)

One thing that was annoying me and some of our customers is that when entering info into rich text field it was simply too narrow. The width is for resolution 1024x768. That's all fine and dandy, but if you like to type a lot the narrow field when entering information just won't do.

To expand the field you have to open the NewForm.aspx and EditForm.aspx in FrontPage or SharePoint designer and just before the </body> tag add the following code:

<script language="javascript" type="text/javascript">
document.getElementById('urn:schemas-microsoft-com:office:office#FIELDNAME_iframe').style.width=WIDTH
</script>


Ofcourse replace the FIELDNAME with actual name of the field and WIDTH with desired width in pixels.

For the FIELDNAME you have to use the SharePoint name, not the display name (sometimes they aren't the same). You can find the SharePoint name of the field easily if you


  1. modify settings and columns of the list

  2. click on the name of the field in the "Columns" section

  3. check value of parameter Field in the URL (click on image below to see the screenshot)


Save the file and you'll have the result. Click on the thumbnails below to see larger images.


Before:



Code:



After:



There you have it. Not as nice to look at, but nicer to write in :).

No comments: