SPCascadeDropdowns Error on Save

Sep 19, 2012 at 3:00 PM

Hi Marc,

I love this feature and (almost) have it working perfectly.  Everything works just as expected until I try to save the changes to columns and then I just get an ambiguous error.  Here's the call I'm using, and the dropdowns are functioning fine.

$().SPServices.SPCascadeDropdowns({
relationshipList: "Sub-Category",
relationshipListParentColumn: "Category",
relationshipListChildColumn: "Title",
parentColumn: "Category",
childColumn: "Sub Category"
});

 

The log for this error, if it helps any.

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 postData, Boolean fBeforeLoad)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) d6f1dd33-5918-427d-98a8-abc00c7ffc35

 

Some quick googling suggests I could turn off event validation to get it working but I'm worried about the security impact this might have.  Is there another way?

Coordinator
Sep 19, 2012 at 3:30 PM

I'm assuming you get the error whan you save the item. My guess then is that there's something not right about your relationship lists and that you've tried to save a value that isn't valid. For instance, you can't add a new value to a dropdown client-side and save it - the view state prevents it.

Is there an error in the browser? Have you tried turning on debug mode?

M.

Sep 19, 2012 at 3:58 PM

The relationships seem to be OK from my angle.  The choices for Sub Category are filtering based on what Category is chosen, just like we want.  Disabling the script allows me to choose any category/sub category available, and all the choices available when the script is enabled are in the entire list.  Based on that I wouldn't expect it's adding new values, unless the act of filtering is 'adding' new values somehow.

Just to triple check, my lists are set up like this.
Category: Only one column, Title (type Text)
Sub-Category: Two columns, Title (type Text) and Category (Lookup to Category)
The current library:  Type, Name, Modified, Modified By, Category, Sub Category.

Tried changing all references (and the list name) of Sub-Category to Sub Category but this didn't resolve the issue.

The only error in the browser is the unhelpful one that pops up when saving. (http://imgur.com/g2ewe)  F12 tools reveals no additional errors clientside.

If by turning on debug mode you mean adding debug:true to the JSON object, this didn't add or change anything when I tried repeating the process.

Sep 19, 2012 at 7:53 PM

Well...I'm not sure exactly what was wrong, but after exhausting all my other options I rebuilt the entire thing and it magically worked.

Potentially what may have happened is I changed a list name or column name somewhere that updated a display name and I could have been getting that confused with a static name.

When in doubt, start over I suppose!

Coordinator
Sep 19, 2012 at 8:20 PM

Glad you got it sorted out. I guess we'll never know.

M.

Sep 19, 2012 at 8:43 PM

Actually, I believe I may have figured it out when repopulating my lists.

When I started out I had 40+ items in my subcategory list and this was causing the function to do nothing at all.  My first reaction was to change the columns from lookups to text - which while it did start filtering based on category, caused the error above.

After rebuilding the lists I only used a few records just to see if it would work, and it did; after which I repopulated the full lists and was back to where I started.

Since I noticed some discussions about the number of items in a list related to this call I decided to delete the list and go back to a few items, after which the filtering was working again but saving got me the ambiguous error again.  I found out the reason for this is that after deleting the list you need to remove and put back the columns that look up to that list or you will get that error, even though it still filters properly.

So, two issues: One was not the column type but the number of items (combined with my jQuery and SPServices version apparently, based on some other discussions I'm searching through).  The other was that deleting and recreating a list will break the lookups to that list.

I switched to 0.7.2 BETA and it fixed my first issue; the other I resolved just now.

Thanks again for this awesome library!