2

I have this jquery added to my editform.aspx in SharePoint. I want the childcolumn to also have unique values, although it may contain duplicates example below.

Example. When I select mycountry, I want JobDes to show me one instance of Information Technology although I might have multiple instances.

I am a complete newbie to jquery, any help appreciated.

enter code here

<script language="javascript" type="text/javascript">
$(document).ready(function() {
    $().SPServices.SPCascadeDropdowns({
        relationshipList: "HR",
        relationshipListParentColumn: "MyCountry",
        relationshipListChildColumn: "JobDes",
        parentColumn: "MyCountry",
        childColumn: "JobDes"
    });
    $().SPServices.SPCascadeDropdowns({
        relationshipList: "HR",
        relationshipListParentColumn: "MyCountry",
        relationshipListChildColumn: "Title",
        relationshipListSortColumn: "ID",
        parentColumn: "JobDes",
        childColumn: "PersonnelNumber"
    });

    $().SPServices.SPCascadeDropdowns({
        relationshipList: "BranchNumber",
        relationshipListParentColumn: "PersonnelNumber",
        relationshipListChildColumn: "Title",
        relationshipListSortColumn: "ID",
        parentColumn: "PersonnelNumber",
        childColumn: "JobNumber"
    });
    $().SPServices.SPCascadeDropdowns({
        relationshipList: "Category",
        relationshipListParentColumn: "JobTitle",
        relationshipListChildColumn: "Title",
        relationshipListSortColumn: "ID",
        parentColumn: "JobTitle",
        childColumn: "Category"
    });

    $().SPServices.SPRequireUnique({    
  columnStaticName: "JobDes",
  duplicateAction: 0,
  ignoreCase: false,
  initMsg: "This value must be unique.",
  initMsgCSSClass: "ms-vb",
  errMsg: "This value is not unique.",
  errMsgCSSClass: "ms-formvalidation",
  showDupes: false,
  completefunc: null
});
});
</script>
2

For relationship column it should be internal name else display name Please refer this.

$().SPServices.SPCascadeDropdowns({
        relationshipList: "HR",
        relationshipListParentColumn: "MyCountry", // Should be internal name
        relationshipListChildColumn: "JobDes",     // Should be internal name
        parentColumn: "MyCountry",           //Should be display name
        childColumn: "JobDes"                // Should be display name
    });
0

Could you please make sure that you have added the Jquery reference and Spservice reference before the code. Without that the code is not going to work.

Secondly you need to check that the column name should be the internal name not the display name.

-Viks

2
  • Hi Viks, Thanks for your reply. I have the reference, but just didn't add it to the question Is my code right? – user2692406 Oct 2 '13 at 21:24
  • Ok great.. then could you please try one block at a time. One cascaded drop down at a time. if that works we can go for all the blocks. – VIKS Oct 3 '13 at 2:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.