1


i have the proplem that the Cascading Dropdown with SPServices dont works. I searched a lot in the internet and in other community-forum but i cant find a solution.

I have 3 lists:
Firmen
Ansprechpartner
Tickets

Firmen(List)
Firmenname(Column)

Ansprechpartner(List)
Vorname(Column)
Firma(Column ~ Lookup --> Firmenname(Firmen))

Tickets
Kunde(Column ~ Lookup --> Firmenname(Firmen))
Ansprechpartner Kunde (Column ~ Lookup --> Vorname(Ansprechpartner))


NewForm in Tickets:

NewForm in Tickets

Implement Scripts in "seattle.Master":
Implement Scripts

Chrome shows that the script is loaded:
Is Loaded

I hope someone can help me!


PS: Sorry for my English :)


EDIT:
After a lot of tries i used a other code which works now.

<script type="text/javascript">
$(document).ready(function() {

    HillbillyCascade({
        parentFormField: "Kunde", //Display name on form of field from parent list
        childList: "Ansprechpartner", //List name of child list
        childLookupField: "Email", //Internal field name in Child List used in lookup
        childFormField: "Ansprechpartner", //Display name on form of the child field
        parentFieldInChildList: "Firma" //Internal field name in Child List of the parent field
    });

});

function HillbillyCascade(params)
{

    var parent = $("select[Title='"+params.parentFormField+"'], select[Title='"+
        params.parentFormField+" Required Field']");

    $(parent).change(function(){
        DoHillbillyCascade(this.value,params);        
    });

    var currentParent = $(parent).val();
    if (currentParent != 0)        
    {
        DoHillbillyCascade(currentParent,params);
    }

}


function DoHillbillyCascade(parentID,params)
{

    var child = $("select[Title='"+params.childFormField+"'], select[Title='"+
        params.childFormField+" Required Field']," +
       "select[Title='"+params.childFormField+" possible values']");

    $(child).empty();

    var options = "";

    var call = $.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/GetByTitle('"+params.childList+
            "')/items?$select=Id,"+params.childLookupField+","+params.parentFieldInChildList+
            "/Id&$expand="+params.parentFieldInChildList+"/Id&$filter="+params.parentFieldInChildList+
            "/Id eq "+ parentID,
        type: "GET",
        dataType: "json",
        headers: {
            Accept: "application/json;odata=verbose"
        }

    });
    call.done(function (data,textStatus, jqXHR){

        for (index in data.d.results)
        {
            options += "<option value='"+ data.d.results[index].Id +"'>"+
                data.d.results[index][params.childLookupField]+"</option>";
        }
        $(child).append(options);

    });
    call.fail(function (jqXHR,textStatus,errorThrown){
        alert("Error retrieving information from list: " + params.childList + jqXHR.responseText);
        $(child).append(options);
    });

}


Thanks for help guys

0

In static name space get converted to x0020

check the static name of the column.

So Your child column will be Ansprechpartner_x0020_Kunde

0

Thanks for den Answer!
But it doesnt work. After this try, i changed the child column to "Ansprechpartner" that i dont have the space. But this was not successful.


enter image description here


My "child column" shows "(None)" so the script recognizes This field. Only the Filter dont works.

0

Did you change the field by just editing its name?

Because once you name a field, that initial name becomes its “internal name” forever. You can change its “display name” all you want but the “internal name” will always be the initial internal name.

The only way you can get this without the space in the “internal name” is to create a new field with the name you want - and you must not have previously used that name for another field, even if you deleted it. (If you did, SharePoint will add digits to the end of the internal name.)

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.