none
Remove Hyperlink column description in a sharepoint 2010 list

    Question

  • Hii,

    In SharePoint 2010 , when i add a column of Hyperlink , its automatically add description column also.But when we enter the values of respective fields its shows the description data in URL column.

    So, please give some suggestions how to remove this problem.

    Best Regards

    Mohit Sharma

    Tuesday, July 30, 2013 7:04 AM

Answers

  • Hello,

    This is design behavior and you can't change. Once you add hyperlink column you get address and description textboxs. Description text is use to hide the actual link and show some friendly name. For example:

    If you put http://www.msdn.com in address and put MSDN in description then in UI you will see MSDN.

    Since you have posted this question in development forum so i am assuming that you want to update this column via code. Here is sample code:

    // Create a link field value.
    SPFieldUrlValue msdnValue = new SPFieldUrlValue();
    msdnValue.Description = "SharePoint";
    msdnValue.Url = "http://msdn.microsoft.com/sharepoint";
                        
    // Create a new list item and set the URL field value.
    SPListItem msdnItem = list.Items.Add();
    msdnItem[SPBuiltInFieldId.URL] = msdnValue;
    msdnItem.Update();
    Hope it could help


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 30, 2013 8:29 AM
    Moderator
  • Hi,

    From my understanding, you may want to set an URL in URL column instead of description text.

    To achieve this, there are two solutions as follows:

    1. When adding a new item, leave the "Type the description" field empty, after saving you will see the URL appears in the URL column.

    2. Modify this list's "NewForm.aspx" in SharePoint Designer 2010, use jQuery code to hide the "Type the description" field, it will be invisible after that. The code is as follows:

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function()
    {
      var obj=$("input[title='Description']");
      obj.parents().find(".ms-formdescription:last").hide();
      obj.hide();
    });
    </script>
    

    Please inform me freely if you have any questions.

    Thanks

    Wednesday, July 31, 2013 11:25 AM
    Moderator

All replies

  • Hello,

    This is design behavior and you can't change. Once you add hyperlink column you get address and description textboxs. Description text is use to hide the actual link and show some friendly name. For example:

    If you put http://www.msdn.com in address and put MSDN in description then in UI you will see MSDN.

    Since you have posted this question in development forum so i am assuming that you want to update this column via code. Here is sample code:

    // Create a link field value.
    SPFieldUrlValue msdnValue = new SPFieldUrlValue();
    msdnValue.Description = "SharePoint";
    msdnValue.Url = "http://msdn.microsoft.com/sharepoint";
                        
    // Create a new list item and set the URL field value.
    SPListItem msdnItem = list.Items.Add();
    msdnItem[SPBuiltInFieldId.URL] = msdnValue;
    msdnItem.Update();
    Hope it could help


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 30, 2013 8:29 AM
    Moderator
  • Hi,

    From my understanding, you may want to set an URL in URL column instead of description text.

    To achieve this, there are two solutions as follows:

    1. When adding a new item, leave the "Type the description" field empty, after saving you will see the URL appears in the URL column.

    2. Modify this list's "NewForm.aspx" in SharePoint Designer 2010, use jQuery code to hide the "Type the description" field, it will be invisible after that. The code is as follows:

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function()
    {
      var obj=$("input[title='Description']");
      obj.parents().find(".ms-formdescription:last").hide();
      obj.hide();
    });
    </script>
    

    Please inform me freely if you have any questions.

    Thanks

    Wednesday, July 31, 2013 11:25 AM
    Moderator
  • This following approach works well in sharepoint 2010 but its not working in sharepoint 2013.. putting css class in newform,aspx also not working.pls send me a wayout to resolve it in sharepoint 2013.

    regards

    cibun swain

    biswakesan90@hotmail.com

    Tuesday, November 18, 2014 11:15 AM
  • Dear Patrick,

    I tried to place the code in newform.aspx page under the announcements tag.But unfortunately i am not able to hide the description.

    Please help me in guiding as to where i should pace the above code to hide the description.

    Thanks in Advance.

    Regards,

    subha

    22 hours 24 minutes ago
  • Hi SubhaO,

    Since the original question is answered, it would be better if you can open a new thread about your question, let's hold the discussion there. One issue in one thread would make others easier to focus on one specific scenario at a time.

    Thanks for your understanding.

    Best regards,

    Patrick


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    21 hours 54 minutes ago
    Moderator