Unexpected Error with SPCascadedDropDown

Jun 24, 2010 at 9:04 PM

I'm hoping this has been seen before and a simple fix is available.

I have SPCascadedDropDown running in a NewForm.  It filters appropriately and I can select the correct value in the childColumn field however, when the form is submitted it returns the "An unexpected error has occured." error.

What is interesting is that if I don't select the value provide in the childColumn and just leave it at the "Choose..." it will post and that field will be blank.

I works when the relationshipList is in the same site as the list I am writing to.  It does not work if the relationshipList is at the root of the collection.  My first thought was SPCascadedDropDown was not intended to be used this way and only works with lists in the same site but after reading some of the threads I see it should so it is probably something I'm doing wrong.

Unfortunatley I cannot get anymore information on the error from the server.

Any thoughts?

Coordinator
Jun 24, 2010 at 9:07 PM

Did you try turning on debug mode? It ought to give you more information to go on.  What are you specifying for the WebURL option?

M.

Jun 24, 2010 at 9:15 PM
Edited Jun 24, 2010 at 9:26 PM

Yes, I used debug to get the whole thing working, it was very helpful.  It is still set to true and there are no errors.

I did not populate relationshipWebURL because I am using a GUID in the relationshipList and based on the Documentation did not think I needed both.

Coordinator
Jun 24, 2010 at 11:19 PM

So are you all set?

M.

Jun 24, 2010 at 11:35 PM

No, nothing has changed.  I got the form to work and filter the results using debug.  That's when the error became apparent and it is still happening which is why I started this thread.

Based on your earlier question, I added the relationshipWebURL option and the path is correct but I am still getting the error.  I know the path is correct because when it is wrong the filter does not work correctly.

Coordinator
Jun 24, 2010 at 11:37 PM

Can you paste in your script?  Hard to know what's happening without the details.

M.

Jun 27, 2010 at 7:18 PM

I'm having this same issue and can't seem to figure out what's wrong.. The input dropdowns filter approriately, however upon submitting the newform.aspx it displays the unexpected error page... it won't even redirect to let users know all required fields have not been inputted correctly.

 

here's the active script:

 

<script language="javascript" type="text/javascript" src="scripts/jquery-1.4.min.js"></script>
<script language="javascript" type="text/javascript" src="scripts/jquery.SPServices-0.5.6.min.js"></script>
<script type="text/javascript">

$(document).ready(
  CTVDropDowns()
);

function CTVDropDowns(){

  $().SPServices.SPCascadeDropdowns({
    relationshipList: "CTV 2 Codes",
    relationshipListParentColumn: "Title",
    relationshipListChildColumn: "CTV_x0020_2",
    parentColumn: "CTV 1",
    childColumn: "CTV 2",
    promptText: "Please Specify {0}...",
    debug: true
  });
}
</script>

here is the url of the error page,

https://[company site]/sites/U-SPOC/T2ICU/Lists/Tier%202%20ICUUSPOC%20Ticketing/NewForm.aspx?RootFolder=/sites/U-SPOC/T2ICU/Lists/Tier+2+ICUUSPOC+Ticketing&Source=https://[company site]/sites/U-SPOC/T2ICU/Lists/Tier%25202%2520ICUUSPOC%2520Ticketing/AllItems.aspx

 

I hope that helps in figuring out what I may be doing wrong...
thanks,
notjj2 

Coordinator
Jun 28, 2010 at 11:54 AM

Success here is predicated on the CTV 2 Codes list being the source for the CTV 2 column as a lookup. Is that the case? It looks like you may have CTV 1 and CTV 2 reversed in the construct. Take a look at the example in the docs for Region / State.

Is gthere any particular reason why you aren't just calling SPCascadeDropdowns in the $(document).ready function directly?

M.

Jun 28, 2010 at 2:31 PM

I'm actually very guilty of having the CTV 1 and CTV 2 columns in reverse order.. I didn't think it'd make a difference but I'll correct the list and repost my results. :)

and I don't have SPCascadeDropdowns directly in the $(document).ready because I'm working with a few others on the scripts and so modular programming helps keep us out of each other's hair.

thanks again,
notjj2 

Coordinator
Jun 28, 2010 at 2:37 PM

No worries! Let me know how it goes.

Gotcha on the modular approach, which is, of course, a best practice. I was just wondering since you only had the one function call.  Don't forget the semi-colon. ;+)

M.

Jun 28, 2010 at 3:41 PM

Sorry for the delay, another fire that took all weekend to put out...

Here is the script...

<script type="text/javascript" language="javascript" src="../../../../jQuery_Libraries/jquery-1.4.2.min.js"></script>
<script type="text/javascript" language="javascript" src="../../../../jQuery_Libraries/jquery.SPServices-0.5.6.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
    alert("Helllo")
  $().SPServices.SPCascadeDropdowns({
   relationshipWebURL: "/dept/cq",
   relationshipList: "{c61daebc-3102-4f13-8168-acb9f57d3307}",
   relationshipListParentColumn: "Title",
   relationshipListChildColumn: "AQE",
   relationshipListSortColumn: "Title",
   parentColumn: "Platform Names",
   childColumn: "Owner",
   debug: true
  });
    });
</script>

While thinking about this over the weekend I believe the script is running correctly and the problem may be in the data being passed to the second list.  Here is what I am trying to do.

The relationshipList is a list of projects with information about the project specifically, 2 columns, Title(Project Name) and AQE(Owner).  Title(Project Name) is a site column and AQE(Owner) is of type “Person or Group”

The list where the script runs is a list of bugs related to those projects so the parentColumn Title is a lookup to the site column relationshipListParentColumn Title(Project Name) and the childColumn would be a filtered list of AQE(Owner)'s.

 When a bug is submitted, it is related to a project through the drop down of the site column, when that selection is made a filtered list of AQE(Owner)’s is presented and the creator can select the appropriate owner.  It all works until you hit OK and the unexpected error.

 So, given that scenario, how should I create the childColumn Owner in the bug list or is this even possible?

RR

Jun 28, 2010 at 6:26 PM

So I recreated my "CTV 2 Codes" list with the parent column being the second column just like in the example. Both "CTV 1" and "CTV 2" are single lines of text, not sure if that matters. Either way, the cascading drop downs work (just like before) but still upon trying to submit the list, it gets an unexpected error... :(

notjj2

Coordinator
Jun 29, 2010 at 1:02 AM

RR: I thought maybe it was the fact that it was a Person or Group column, but I just tested that and it works.  What type of column is the Owner column in the bug list? I would assume that it is a Person or Group column, but then it wouldn't be a dropdown, so I'm not so sure.  and I hate to assume.

notjj2: This unexpected error has to be because the value you are selectign from the dropdown isn't valid based on the type of column or a constraint on it.

All I can suggest for both of you is to run through the docs again and make sure you have things set up equivalently.

M.

Jun 29, 2010 at 3:09 AM

after reading through the documentation about 10 times I finally figured out my problem...

The second prerequisite is "The dropdown for childColumn is a lookup into relationshipList's relationshipListChildColumn column OR a list column which is a lookup into another list column ("secondary list")."

That was my problem... my childColumn was a Choice rather than a Lookup...

thanks for the help,
notjj2 

Jun 29, 2010 at 4:42 PM

Good news is, it sounds like it should work, bad news is I can't seem to get there.

It appears that the issue is with the childColumn and how it is defined.  Are you saying you got it to work using a Person or Group column?

In answer to your question I have tried Person or Group and Lookup without success.

When I use a Person or Group column I get a debug error saying

Parameter
childColumn: Owner
Message
Column not found on page.

I'm also trying to interpret this sentence; The second prerequisite is "The dropdown for childColumn is a lookup into relationshipList's relationshipListChildColumn column OR a list column which is a lookup into another list column ("secondary list")."

I don't see how to do a lookup into the relationshipList's relationshipListChildColumn when it is a People or Group column so that leaves me with a lookup into a "secondary list".

Is this where I am missing something?

At this point I would like to see if I can recreate what you got working.

 

Coordinator
Jun 30, 2010 at 12:06 PM
Edited Jun 30, 2010 at 12:06 PM

Excellent, notjj2 ! The details always get you. That would throw the error because the value was the ID rather than the text, which wasn't valid.

M.

Jun 30, 2010 at 9:56 PM

M.

How did you create the childColumn field when you tested the People or Group functionality?

Coordinator
Jun 30, 2010 at 9:59 PM
PGh0bWw+PGJvZHkgYmdjb2xvcj0iI0ZGRkZGRiI+PGRpdj5JIGp1c3QgcG9pbnRlZCBteSBjaGls ZENvbHVtbiB0byBBdXRob3IuIFJlbWVtYmVyIHRoYXQgdGhlIGNoaWxkQ3VsdW1uIGhhcyB0byBi ZSBhIGxvb2t1cC4uLjwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+TS48YnI+PGJyPjxkaXY+PGJy PjwvZGl2PjwvZGl2PjxkaXY+PGJyPk9uIEp1biAzMCwgMjAxMCwgYXQgMTc6NDYsICJycm9iZXJ0 cyIgJmx0OzxhIGhyZWY9Im1haWx0bzpub3RpZmljYXRpb25zQGNvZGVwbGV4LmNvbSI+bm90aWZp Y2F0aW9uc0Bjb2RlcGxleC5jb208L2E+Jmd0OyB3cm90ZTo8YnI+PGJyPjwvZGl2PjxkaXY+PC9k aXY+PGJsb2NrcXVvdGUgdHlwZT0iY2l0ZSI+PGRpdj4gPHN0eWxlPkJvZHl7Zm9udC1mYW1pbHk6 IFZlcmRhbmE7IGZvbnQtc2l6ZTogMC43NWVtO30jVGhyZWFkTm90aWZpY2F0aW9uRm9vdGVye2Nv bG9yOiBncmF5OyBib3JkZXItdG9wOiAxcHggc29saWQgI2NjYzt9I1RocmVhZE5vdGlmaWNhdGlv blBvc3RCb2R5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U1BTZXJ2aWNl c0BkaXNjdXNzaW9ucy5jb2RlcGxleC5jb208L2E+PC9hPjwvcD4gPHA+WW91IGFyZSByZWNlaXZp bmcgdGhpcyBlbWFpbCBiZWNhdXNlIHlvdSBzdWJzY3JpYmVkIHRvIHRoaXMgZGlzY3Vzc2lvbiBv biBDb2RlUGxleC4gWW91IGNhbiA8YSBocmVmPSJodHRwczovL3Nwc2VydmljZXMuY29kZXBsZXgu Y29tL3N1YnNjcmlwdGlvbnMvdGhyZWFkL3Byb2plY3QvZWRpdCI+dW5zdWJzY3JpYmUgb3IgY2hh bmdlIHlvdXIgc2V0dGluZ3M8L2E+IG9uIDxhIGhyZWY9Imh0dHA6Ly9jb2RlUGxleC5jb20iPmNv ZGVQbGV4LmNvbTwvYT4uPC9wPiA8cD5QbGVhc2Ugbm90ZTogSW1hZ2VzIGFuZCBhdHRhY2htZW50 cyB3aWxsIGJlIHJlbW92ZWQgZnJvbSBlbWFpbHMuIEFueSBwb3N0cyB0byB0aGlzIGRpc2N1c3Np b24gd2lsbCBhbHNvIGJlIGF2YWlsYWJsZSBvbmxpbmUgYXQgPGEgaHJlZj0iaHR0cDovL2NvZGVw bGV4LmNvbSI+PGEgaHJlZj0iaHR0cDovL2NvZGVwbGV4LmNvbSI+Y29kZXBsZXguY29tPC9hPjwv YT48L3A+IDwvZGl2PiAgPC9kaXY+PC9ibG9ja3F1b3RlPjwvYm9keT48L2h0bWw+ --Apple-Mail-1--1019747426--
Jul 6, 2010 at 7:11 PM

So...translation is "you can't get there from here"?

Coordinator
Jul 7, 2010 at 11:34 AM

Ick. No, the translation there is "my iPhone initiated email turned into gobbledy-gook".

I just used the Created By (Author) column to see if I could add it as the relationshipListChildColumn value.  I didn't test the full process, though.  You're right on the lookup issue.  Person or Group columns can't be used as the source for lookup columns. (SharePoint's limitation, not mine.)

M.

Jul 7, 2010 at 3:09 PM

M.

I was beginning to think I had really missed something and I should just go home, thanks for clarifying that for me…;-)

I am confused about one thing and maybe with your experience the answer is obvious but, in my opinion, it is the root of my problem and anyone else who is trying to use this scripts capability.

Given the ability to do a cross site query using the GUID for the relationshipList, which works very well by the way, how would you ever create the childColumn lookup from a subsite even if it was not a Person or Group column?

From what I understand about how the script works it returns the row, not the data, so unless the lookup for the childColumn is into the relationshipList across the subsite boundry it will never return the correct answer and you will get the SharePoint error I am getting.

Is there a way to get around the SharePoint limitation on cross site lookups during the creation of the childColumn in the subsite that does not require installing a third party extension?  I don't have that permission on our server.

Thanks again for your support during this process.

RR

Coordinator
Jul 8, 2010 at 3:41 AM

RR:

Typically, if you want to use these types of values across sites, you'd create a Site Column which is a lookup column into a list in the root site. Then you can add that Site Column to any list in the Site Collection.  Does that make sense?

M.