This project has moved and is read-only. For the latest updates, please go here.

SPCascadeDropdowns Required Field Question

Nov 1, 2014 at 6:10 PM

So another issue that has come up for me while using SPCascadeDropdowns is as follows:

When using cascading dropdowns on non-required fields, it displays (None) for the first, second and third dropdowns (which is ideal in my situation).

If I use them as required fields, it's populating all 3 dropdowns with values out of the lookup lists which I don't want initially, because they can simply submit the data without actually choosing the correct values. Essentially, I want them to see the (None) option as well on required fields.

Is there a trick to doing this?
Nov 2, 2014 at 3:40 AM
If you remove SPCascadeDropdowns, reverting to SharePoint's default behavior, you'll see that's the way SharePoint sets it up. The problem with adding a new value for "(None)" for required fields is that SharePoint then throws a hideous error when the form is submitted if the "(None)" value is left selected. This is because the "(None)" value isn't in the original form digest.

If you add PreSaveAction logic to catch the "(None)" value before submission, then there's an option on the SDPCascadeDropdown function for promptText, which will add a new option at the top of the list and select it.