CORS error when saving a form containing dropdown list modified via jQuery


Badge +6

When trying to submit a form containing a dropdown list populated via jQuery, i get the following error:

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 System.Web.UI.WebControls.DropDownList.LoadPostData(String postDataKey, NameValueCollection postCollection)     at System.Web.UI.Page.ProcessPostData(NameValueCollection pos...

I tried enabling CORS in my Web API application, but it didn't seem to make a difference.

Do you have any idea how I can set the enableEventValidation to False in the Nintex form templates?


4 replies

Userlevel 5
Badge +14

here is a topic that recently dealt with the similar/same(?) problem NCAA bracket in Nintex Form

I haven't followed it since it was quite long and a bit out of my interest, I just remember it was being discussed and at the end some resolution was presented

Badge +6

Hey Marian,

Thanks for your reply, I managed to solve this yesterday by attaching a function to the save (and submit) buttons that disabled the custom dropdown lists, so no exception was generated when submitting the form.

Badge +7

Themos K‌, Can you post your code to show how it prevented the error?

Badge +6

Hey Chad Davis‌,

It's been over 2 years but I managed to dig up some of my old code, hope it might be of help!

PS: We've since migrated away from Nintex to using Aurelia.js, only about a million times more powerful and clear code happy.png

// DISABLE all lists in array
function DisableAllLists(ddlNames) {
   NWF$.each(ddlNames, function (index, value) {
      value.prop("disabled", "true");
   });
}

// DEFINE ALL dropdownlist objects
var PayrollPeriodList = NWF$('#' + ddlPayrollPeriod);

// ADD all list definitions to array, separated by commas
var DDLNames = [PayrollPeriodList];

// HANDLE document submition
NWF$(document).submit(function () {

   if (NWF$('.nf-validation-summary').css('display') == 'none') {
      DisableAllLists(DDLNames);
   }
});

Reply