AnsweredAssumed Answered

Dynamically populate dropdown - Invalid postback or callback argument error on Submit

Question asked by ashindass on Jul 23, 2015
Latest reply on Dec 3, 2015 by cju@evolusys.ch

I am trying to populate a dropdownlist dynamically in a nintex form. The list will display all the list Titles in a site. I have a text box field to enter the url for the site and based on the url the dropdownlist will be populated. Adding the source code below.

 

 

The dropdownlist is populated based on the url. But when I select the list title and submit the form it is throwing Invalid postback or callback argument error.

 

NWF$(document).ready(function(){

 

NWF$('#'+Title).change(function() {valueChanged()} );

 

 

function valueChanged() {  

 

  var url= NWF$('#'+Title).val();

    $.ajax({

        url: url+"/_api/lists",

        type: "GET",

        headers: {

            "accept": "application/json;odata=verbose",

        },

        success: function (data) {

for(var i=0;i<data.d.results.length;i++)

{

var text=data.d.results[i].Title;var val=data.d.results[i].Title;NWF$('#'+ShrptList).append( new Option(text,val) );}

} ,

        error: function (error) {

            alert(JSON.stringify(error));

        }    });

 

}  

});

 

 

I checked the thread The specified item was not found.  and as mentioned in the solution I tried loading the dropdown on page load itself.

as shown below ( added the script to load dropdownlist directly to the custom javascript option in form settings) and still it is throwing the same error. Please confirm whether I am doing this correctly.

 

 

var url= "url of site";

    $.ajax({        url: url+"/_api/lists",        type: "GET",        headers: {            "accept": "application/json;odata=verbose",        },        success: function (data) {for(var i=0;i<data.d.results.length;i++){ var text=data.d.results[i].Title;var val=data.d.results[i].Title;NWF$('#'+ShrptList).append( new Option(text,val) );}  } ,        error: function (error) {            alert(JSON.stringify(error));        }    });

 

 

 

Please help me with this error.

Outcomes