Answered Auto Populating Dropdown Column in Sharepoint List

  • Tuesday, May 08, 2012 8:40 AM
     
     

    Hi,

    I have 2 sharepoint Lists. List A and List B

    List A

    Alphabet    Numeric

    A                1

    A                2

    A                3

    B                4

    B                5

    List B

    Alphabet(Lookup)   Numeric(Lookup)

    I am populating the Alphabet in List B to values A and B

    When i choose A in alphabet, I need to get 1,2,3 in Numeric Automatically

    When i choose B in alphabet, I need to get 4,5 in Numeric Automatically

    Please help

    Thanks

All Replies

  • Tuesday, May 08, 2012 9:14 AM
     
     

    Hi,

    Take a look at the following link, I think it may get you what you require without writing code.

    http://msdn.microsoft.com/en-us/library/ff798514.aspx

    Regards,

    Luke

  • Tuesday, May 08, 2012 10:49 AM
     
     Answered Has Code

    Hi,

    According to your arequirements you are actually looking for cascaded look up column, to achive this functionality you may need to create one more list where you will keep original values,

     Please follow below steps to create cascaded lookup column.

    <script language="javascript" type="text/javascript" src=" /Shared%20Documents/jquery-1.3.2.min.js"></script>
    <script language="javascript" type="text/javascript" src=" /Shared%20Documents/jquery.SPServices-0.5.6.min.js"></script>
    <script language="javascript" type="text/javascript">
    $(document).ready(function() {
    $().SPServices.SPCascadeDropdowns({
    relationshipList: "CategoryRelationList",
    relationshipListParentColumn: "Category",
    relationshipListChildColumn: "Title",
    parentColumn: "Category",
    childColumn: "Product",
    debug: true
    });
    });
    </script>


    OR the other way to achieve this is open SharePoint designer and then open site where this list is located, open NewForm.aspx, check out the form and find the following line.
    <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
    Add the above script exactly below this. Save it and check in. This will also do the job for you. Do the same for edit form as well?
    Now let me explain each parameter in the script.
    relationshipList – This is the name of the list where we have kept the relationship.
    relationshipListParentColumn – This is the parent column in the relationship list.
    relationshipListChildColumn – This is the child column in the relationship list.
    parentColumn – parent column in the list where we want to implement this.
    childColumn – child column in the list where we want to implement this.


    Thanks.... ________________ Baba (MCTS, MCPD)


  • Wednesday, May 09, 2012 2:31 AM
     
     
    Thanks Mr.Baba for your solution.....