Posts

Showing posts from May, 2012

The security validation for this page is invalid in SharePoint

While doing coding you must be familiar with following error. “The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again” The above error you will face in two cases. 1. When you do updates in GET requests. 2. When you have a least permissions in the SharePoint site, create or update an item. 3. Even though you have full permissions you may face this error in Post requests. When you do search for resolution in google every one suggest to use following statement. web.AllowUnsafeUpdates = true; ... ... web.AllowUnsafeUpdates = false; But we should only use above property when you are doing any updates in GET request it means page load event. Allowing updates in page load might allow Cross-site request forgery (CSRF or XSRF) security attacks due to this by default SharePoint will not allow any updates in the site especially in GET requests. So If you have a situation that you must have to do some i...

Custom List Form in SharePoint Designer 2010 will not render if the list has a large number of columns

This solution given by Microsoft Premier support. I found this at http://social.technet.microsoft.com/Forums/en/sharepoint2010customization/thread/11a8b7c7-6bdd-485e-a8c6-083896cf6f83 Also Microsoft has given few more alternate solutions for this. http://support.microsoft.com/default.aspx?scid=kb;EN-US;2639184 Symptom Custom List Form will not render if the list has a large number of columns. To reproduce this issue create a custom list and add 68 single line of text columns. The custom list form web part will not render and an error message such as this will occur in the browser: Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator. Correlation ID: Cause This occurs when a large XSL transforms happens in a single template. Resolution The issue can be resolved by breaking up the o...

Disable spell check for People Picker

People picker control just contains login names and it should not be checked for spellings but SharePoint does it. Practically it is not acceptable so we have to restrict this. I have written small javascript code to inject this. In OOB we have one property ( excludeFromSpellCheck ) to avoid spell check for specific controls. But by default it will not work for people picker control because it is collection of input controls. If you inspect the control using IE developer toolbar you can find the login details hold by textarea field. So using following script I am setting above property to avoid spell check.  <script type="text/javascript"> _spBodyOnLoadFunctionNames.push("disableSpellCheckOnPeoplePickers");    function disableSpellCheckOnPeoplePickers() {     var inputs = document.getElementsByTagName('TextArea');        for (var index = 0; index < inputs.length; index++) { ...

Spell Check for specific controls in SharePoint

Image
By default we already have a Spell Check option in SharePoint and it will check entire page. But recently one of my colleague got a requirement that their customer wants spell check for specific controls means there are two multiline text boxes and adjacent to each text box there will be a button to do spell check. Customer wants to enable spell check to specific control explicitly. Hope you people may know that there are two components involved to do spell check OOB. One is webservice ( SpellCheck.asmx ) and another one is applicaiton page ( SpellChecker.aspx ). In OOB we already have one javascript file called SpellCheckEntirePage.js and it has all the code related to Spell check. It will do the following steps. Get all elements in the page and stores in a array. Loop through each element to identify input field elements and stores in another array. Stores each elements value in another array called ChunksToSpell. Also it stores each control reference in another array ...