Unexpected error submitting a new/edit form when using SPCascadeDropdowns and not setting a required field

Apr 18, 2014 at 11:49 AM
Edited Apr 18, 2014 at 11:50 AM
  • Using a straigtforward Cascading dropdown with a parent and child column in new/editform.
  • Office 365 (SP 2013): Dutch language
  • Event (Calendar) list.
  • Content Type based on "Event" CT.
  • Parent column A: single value lookup to custom list.
  • Child column B: single value lookup to custom lookup list.
  • jquery 1.10.2
  • spservices 2014-1
  • Both column A and B are required
  • Not using the promptext() or nonetext()
  • Default value of column A is the first value in the list
  • Default value column B is (none)
  • The cascading works
  • When submitting the form without setting the B column(required) I get an unexpected error. Probably because of the (none) value.
  • The odd thing is: I have another list (custom list, not event list) with the same setup. Also even when using nonetext(), SharePoint appoints that it's a required column and must be set.
  • So I'm wondering what's going on.
the code I'm using is:
//Cascade cliënt-doelstelling
  relationshipList: "Zorgleefplan doelstellingen",
  relationshipListParentColumn: "Cli_x00eb_nt",
  relationshipListChildColumn: "Title",
  parentColumn: "A Vereist veld",
  childColumn: "B Vereist veld",
  simpleChild: true,    
  matchOnId: true,
  debug: false
*note: the "Vereist veld" is needed whenever I set the column to required since 2014-1 does not solve that problem (at least not for me :-) )

Thanks in advance. SPServices is a great piece of work!
May 21, 2014 at 10:56 AM
Edited May 21, 2014 at 10:56 AM
I also has the same issue. Is there any resolution even after setting a required field it still show NONE i.e. after FEB CU
May 21, 2014 at 2:23 PM
It may be that the SPServices code is creating the "(None)" value, which is invalid for a required column. This would throw an error.

I don't have a Dutch installation, as you might expect, so I can't test anything similar.

Can you tell where the error is occurring? Is it only on submission, or are there script errors in the page prior to submit?

May 21, 2014 at 5:17 PM
It is happening after submission i.e. it throws unepxpected error page same explained by maunx above. Please find the attached screen shot. Problem is with the NONE text because of which it also throws error saying lookup field does not exist. the only problem is with NONE text getting appearing, is there any way i can prevent this to appear in order to avoid confusion for the user.
May 22, 2014 at 8:04 AM
  • Normally when using non-required lookups, SharePoint gives (none) as the fist option, also in Dutch sites.
  • As known, when making it required the (none) option disappears and the first value is pre-set when starting the newform. (making the required option essentially useless but that aside)
  • When using cascade dropdowns with required lookups, the (none) value remains selectable. SPServices has the option to change the (none) value into something else.
  • I remember (at some instances in SP2010 but don't remember the versions/context) that when you select and submit a newform (cascading dropdown/required columns) when the (none) value is selected you would get an ugly error, which was also a known issue.
  • In SP2013 (in my case Office 365), when using the (none) value (or changed to (geen) with SPServices), SharePoint perfectly validates it as unselected. No problems at al. (I only do had to change order of the values with JavaScript so that (none) was indeed the first selected 'value'. Whether that is SharePoint thing or an SPServices solution I don't know.
  • The only instance where it still throws the ugly error is when using (none)/required in forms attached to a calendar list (with 'event' as the base content type).
  • The error occurs when submitting the form, when using the recurring pattern (when (none) is selected) and when editing the form in edit mode and switching to display mode again. The value is simply not accepted.
My question would be: What is the difference in the situation. Why does SharePoint validate the (none) value as everyone wants it to do when using standard lists and why does it throw the know ugly error again when using an event/calenderlist.
May 23, 2014 at 11:19 AM
any ideas would be appreciated or any workaround where i can prevent user from seeing "None" for the required Fields. This is working vice versa.
Jul 7, 2014 at 8:50 AM
I've just hit the same problem and wanted to share my solution (I know it's an oldish thread, but it might help someone).

My circumstances are that I'm running on MOSS 2007 and have this same required column displaying a "(None)" value when using SPCascadeDropdown. Noticably I'm using an old version of the library (0.7.2) so this may or may not be relevant in the current version; I haven't tested with newer versions because I am forced to use the older version in my environment for non-technical reasons.

My solution is to manually validate in the JavaScript, thus preventing the page from posting back an invalid value. You need to create an error message, as there isn't one by default and then use the presave function in the newform/editform to validate and prevent postback. The "(None)" entry has a value of "0" which you can check for and intercept. (The field I ripped the below from is called "Year" - you'll want to change that $("[title='Year']") if you use this)

First, my version of an error message:
$("[title='Year']").next().after($("<div id='YearWarn' class='ms-formvalidation'>You must select a Year.</div>").hide());
and I stick something like this into the $(document).ready(function() { })
PreSaveAction = function(){

    var valid = true;

    if ($("[title='Year']").val() === "0") {
        valid = false;
    return valid;
(This is probably a bit naughty as I'm forcing an implied global - it does mean that I can test for content type and define the entire presave differently if needed though)

I daresay that there are other ways around this. I'd love to know if there was a better way.