1

I want to use SPServices to get cascaded dropdowns. A first dropdown menu will include, depending on the first choice, the choices of the second dropdown menu.

I have 3 lists. The first one is a basic list. The second one has a lookup field from the first one. And the third one has 2 lookup fields: one from the first list and the other one from the second list.

On the example below, the choice "Catégorie 1" just have to show "Choix 1.1" and "Choix 1.2", and not the others.

enter image description here

In my NewForm.aspx, I've put that code :

<script src="/sites/DevNum/testsb/js/jquery.js" type="text/javascript"></script>
<script src="/sites/DevNum/testsb/js/spservices.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
    $().SPServices.SPCascadeDropdowns({
      relationshipList: "typesinterventions2",
      relationshipListParentColumn: "Cat_x00e9_gorie", //Static Name
      relationshipListChildColumn: "Title", // Static Name
      parentColumn: "Type de la demande", //Printed Name
      childColumn: "Sous-type de la demande", //Printed Name
      debug: true
    });
});
</script>

Just under this line :

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

When I click on "Add new element", nothing special happens.

The console log of my browser returns nothing, only this little warning :

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

On the line 148 in catcher.js, which means this line :

open.apply(this, arguments);

Then, I don't know where can be the problem.

  • Can you try to add the jquery code on a js file, upload js file to document library and then try to reference js file on newform.aspx. – Monica Jagani Apr 25 '16 at 10:29
  • You mean the "jquery..js" or the SPServices script ? Or both ? – Slabre Apr 25 '16 at 12:06
  • both ... jquery.js also in document library and spservices script in same document library. for testing purpose try to keep full url for jquery.js reference. Once it work... make it relative url – Monica Jagani Apr 25 '16 at 12:37
  • Unfortunately, nothing different happens. – Slabre Apr 25 '16 at 13:13
  • I'd like to inform you that my .js are referencing correctly. I've done that with this link – Slabre Apr 25 '16 at 13:14
1

I think you have to modify two parameters :

  parentColumn: "Type de la demande", //Printed Name
  childColumn: "Sous-type de la demande", //Printed Name

TO

  parentColumn: "Catégorie", //Printed Name
  childColumn: "Choix", //Printed Name

The problem comes from these parameters because you have to write exactly what is written on the form. In your case : "Catégorie" and "Choix".

0

You can simply use the infopath way to custom a list form :

enter image description here

And here is a tutorial that explains how to do what you want : https://www.youtube.com/watch?v=-HnLhXVQf-M

  • I've seen that but in my company there's no way to use InfoPath because we don't have SP Enterprise. But thank you. – Slabre Apr 25 '16 at 8:42

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.