Thursday, October 18, 2012

Fix for “The column name that you entered is already in use or reserved. Choose another name." Error

When you’re creating columns either the Site Columns or the List Columns in SharePoint, suddenly it might show a message stating “The column name that you entered is already in use or reserved. Choose another name.”. 







When this error comes, you normally go to the create new column page and try to add the same content type again. But the added column will not be shown in the column list. To display this column in the content type column list, just run the following script.

javascript:g_FieldName={};alert('Successfully cleared forbidden columns');

Copy the above script and paste it in the browser URL and then press enter. You will get a confirmation message box as shown below.













After clicking OK, when you go again to the content type columns page, the column will become visible.


Tuesday, October 16, 2012

Meta title and Meta description tags in SharePoint Publishing Page properties

This article is regarding how to add the meta title, meta description and the meta keywords in SharePoint publishing page.

If a SharePoint page is associated with the content types such as Meta Title and Meta description, and you will go to the page properties and tried to add the meta title and the meta description and check-in the file and publish. When you view the HTML source of that page in View Source Option, the added meta title and the meta description tags are missing.

To make the meta tags to appear in the page source we have to follow the following steps.

1.Add the following content place holders in the master page of the site.


2. Save the master page and check-in and publish this.
3. Open the default page of the site and check the ids for the content type or the ids for fields defined in the html code of that page.
4. Note the ids for meta title and meta description.
5. Now go to the corresponding layout page and add the following tags in the layout page of the sites to whom all the content pages are getting inherited. Also add the following piece of code just above the Place Holder Main.








Check in the files. 
Now go to the content pages and add the data for meta title and the meta description.

After publishing the file, open the file in browser and check the View Source. The tags will start appear.

CSS Class to prevent the Ligatures in Firefox.

Some times the Mozilla Firefox browser will hide the texts like “ff, fi, fl, ffi, ffl”. Hence the word "Benefits" looks like "Benets".

Hence to prevent this we need to add the following line of css style class in the corresponding .css file of the application. 


-moz-font-feature-settings: "liga=0";
-moz-font-feature-settings: "liga" 0;

Add the above lines of code in the css class and the ligatures will be disabled.

Email Validation using JavaScript & Regular expressions

The Email validation for the 2,3,4 digit suffixes can be implemented using the following regular expression. 


function IsValidEmail(e) {
        var alnum = "a-zA-Z0-9";        
        exp = /^[a-zA-Z0-9._]+[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-zA-Z]{2,4}$/;
        emailregexp = new RegExp(exp);

        result = e.match(emailregexp);
        if (result != null) {
            return true;
        }
        else {
                 return false;
        }
    }

Use the above code to validate the email.