Does anyone have any success with doing this?
My jquery looks
// remove the item not needed
NWF$('#' + choiceID).find("option[value='Test']").remove();
// add new item
NWF$('#' + choiceID).append($('<option value="' + managerUserprofile.email + '">' + managerUserprofile.firstName + '</option>'));
How can I populate a dropdown using items from javascript?
Hi Lars,
Looks like you are having the same issue as discussed here Re: Invalid postback and call back Argument : dropdownlist problem?
Maybe the discussion here might help you solve your problem
Jeremy
I have a smiliar problem. #
nintex forms javascript jquery dropdown
Content tagged with nintex forms javascript jquery dropdown
I have a drop down on the selection of this dropdown I am flitering the value from a sharepoint list and setting the another dropdown using the below code...
function Category_DropDown() {
var custDrpDwnVal = NWF$("#" + BusinessArea).val();
var context = new SP.ClientContext();
var oList = context.get_web().get_lists().getByTitle('Categories List');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=\'Title\'/><Value Type=\'Text\'>'+custDrpDwnVal+'</Value></Eq></Where></Query></View>');
selectedListItems = oList.getItems(camlQuery);
context.load(selectedListItems);
context.executeQueryAsync(Function.createDelegate(this, this.onSelectedListSuccessMethod), Function.createDelegate(this, this.onSelectedListFailureMethod));
}
function onSelectedListSuccessMethod(sender, args)
{
var selectedListEnumerator = selectedListItems.getEnumerator();
var options = "";
var category = NWF$("#" + Category);
while (selectedListEnumerator.moveNext())
{
var oListItem = selectedListEnumerator.get_current();
var categories = oListItem.get_item('Category_x0020_Value');
options += "<option value='" + categories + "'>" + categories + "</option>";
}
category.html(options);
}
I get the value in my dropdpown but when i save these values i get a co relation id error and checked the logs and found below error :
1. Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) at
2. ...Controls.DropDownList.LoadPostData(String postDataKey, NameValueCollection postCollection) at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boole
Lars,
Did you ever solve your issue? I also have the same problem. Code works find populating dropdowns but get a correlation error when saving the form. The link Jeremy provided doesn't give any detail on how the problem was solved.
Hi Lars ,
Yesterday I could solve this problem.I dont think is there any logic in this solution.
I have put all the dropdown values in the Sharepoint dropdown Column as well which I am trying to set through Java.
I hope that solve ur issue.
Mohit
I believe we can solve this issue by putting the control population inside Page_Preload but I'm not sure how to do this in Nintex Forms or with Javascript... Since my values are constantly changing at the source I can't manually populate the choice control with options beforehand. I need to be able to dynamically populate before and when the user makes a selection. Not sure if this is solvable with Nintex.