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.

Wednesday, October 12, 2011

Opening an Infopath form library template from Infopath in a link

I've found a lot of bad info on how to do this and it's not well documented so hopefully this helps someone:

first create a JavaScript function so that your links aren't super long:


<script type="text/javascript">
            function OpenForm(absSiteUrl, siteRelFormUrl, siteRelSaveUrl)
            {
                        var formUrl = absSiteUrl + siteRelFormUrl;
                        var saveUrl = absSiteUrl + siteRelSaveUrl;
                        var formSvcUrl = absSiteUrl + "_layouts/FormServer.aspx?XsnLocation=" + formUrl;
                        CoreInvoke('createNewDocumentWithRedirect2',event, formUrl, saveUrl, 'SharePoint.OpenXmlDocuments.2', true, formSvcUrl, false, 0);
            }
  </script>

then create a link like so:

<a href="javascript:OpenForm('[AbsoluteSiteUrl]','[SiteRelativeFormUrl]','[SiteRelativeSaveLocationUrl]')">open form</a>

here are examples for the vars
[AbsoluteSiteUrl] = http://mysp2010server/siteA/
[SiteRelativeFormUrl] = myformlibrary/Forms/template.xsn
[SiteRelativeSaveLocationUrl] = myformlibrary

Tuesday, October 11, 2011

People Search from MySite returns 404

If you have MySites and a Search Center running in your farm, you may have overlooked a not-so-obvious configuration setting. When setting up MySites for a User Profile service application, your Search Center URL must point to the "Pages" folder where the Search Center publishing pages are located instead of the Search Center web URL. Otherwise, a People Search from a MySite will forward the request to to

http://[searchcenter]/PeopleResults.aspx?k=searchquery


(which doesn't exist) instead of

http://[searchcenter]/PeopleResults.aspx?k=searchquery

which is where the PeopleResults.aspx page is actually located.


TLDR: Use http://[searchcenter]/Pages/ for your Search Center url in UPA MySite Settings.