Chris G.
Chris G.

Reputation: 339

SharePoint 2013 jQuery appended option value not saving

I've got a set of 3 cascading dropdowns that I'm populating via jQuery and several JSON formated objects that represent the list and field relationships.

The values for the first two levels of the cascade are saving properly to the list but the value of the 3rd level of the cascade isn't saving at all, even though I can see it in the DOM as selected, and I can output its value to the console log.

// Populate the select
$.each(oDynDDx3vals[myList], function( ) {
    var myTxt = this[chiListField];
    var myVal = this.ID;            
     console.log("ID: " + myVal +" Txt: "+myTxt);
    // iterate over values and add value only if it hasn't already been used.
    if($.inArray( myTxt, usedVals ) == -1) {
        // add value to the array for comparrison
        usedVals.push(myTxt);
        // append option to select
        myChildSelect.append($('<option>', {value: myVal ,text: myTxt}));   
    }   
});

I've tried the following to no avail.

$("select[title='Third Level']").change(function (){        
        alert('trigger');   
        $("option[value=" + this.value + "]", this).attr("selected", true).siblings() .removeAttr("selected");
        var txtProdVers = $("select[title='Third Level'] option:selected").text();
        var valProdVers = $("select[title='Third Level'] option:selected").val();       
        console.log("FORM:  ("+valProdVers+") "+txtProdVers );
});

Any ideas? And thank you very much, in advance!

~C

Upvotes: 1

Views: 619

Answers (1)

Chris G.
Chris G.

Reputation: 339

In the spirit of ridiculous mistakes- turns out the source list of the lookup columns was modified during migration between environments. It was not accepting the values being submitted because they weren't actually valid for the list that was now being used as the source.

Solution: remove field from content type. Remove site column. Add back referencing the proper lookup list.

apologies for wasting your time.

~C

Upvotes: 1

Related Questions