문제

I've been following the video tutorial on using select boxes, and creating cascading dropdowns. The first level populates as expected, however the second child list is not populating. Looking at the console there are no errors.

$("#StateSelect").Forms7LoadDDL({
    listName: "States",
    firstOptionText: "Select State",
    fieldName: "Title",
    childID: "CitySelect",
    childList: "Cities",
    childParentField: "State",
    childField: "Title",
    childOptionText: "Please Select City",
    completefunc: function() {
        alert("Parent Select Loaded");
    },
    childCompletefunc: function(){
        alert("Child Select Loaded");
    },
}); 


Title: <input type="text" id="TitleField" listFieldName='Title' class='required' >   <br/><br/>
Email: <input type="text" id="EmailField" listFieldName="email" > <br/><br/>
State: <select id="StateSelect"></select><br/><br/>
City:  <select id="CitySelect"></select><br/><br/>
도움이 되었습니까?

해결책

Do the following changes

<select id="StateSelect"  onchange="LoadCities(this.value);"></select>

$(document).ready(function() {
    $("#StateSelect").Forms7LoadDDL ({
        listName: "States", 
        firstOptionText: "Select State",
        fieldName: "Title"
    });      
});

function LoadCities(stateID) {
    $("#CitySelect").Forms7LoadChildDDL({
        parentID: stateID,
        parentField: "State",
        listName: "Cities", 
        firstOptionText: "Select City",
        fieldName: "Title"
    });
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top