Wednesday, January 4, 2012

Using JQuery to Tweak Editform.aspx

For smaller changes to your Editform.aspx you may want to avoid doing a solution deployment that contains a custom content type feature with a custom EditForm.aspx.  This is a quick workaround.  It's pretty much the same as we used to to in MOSS with only minor changes to the way you get to the form.

I did this in IE, but it's probably similar in other browsers:

  1. Place an html document containing some JavaScript/Jquery into a document library on your list's site.  (Try just putting this for initial testing: <script type="text/javascript">alert('hello world');</script>)
  2. Navigate to the list whose editform.aspx you want to change
  3. Right click on any item's link to it's display form and choose 'open in new tab'
  4. Go to the newly opened tab and click the 'Edit Item' button  to open the item in the editform.aspx
  5. append &ToolPageView=2 to the url
  6. Add a Content Editor Web Part and point it to your document from step 1.
This shouldn't be a replacement for all customized EditForm.aspx's by any means, but it's still a useful trick for quick fixes that don't justify custom development.