SPCascadeDropdowns on EditForm.aspx followup

Sep 1, 2011 at 9:05 PM

Marc,

 

 

This thread is following the existing "SPCascadeDropdowns on EditForm.aspx" thread in the discussion.

I am having the same issue as the original thread described. The child multi select lookup field losses its initial selection(s) in the editForm.aspx page. After simplifying my cascading scenario and tried some combinations, I found:

1. Changing the child lookup field to be required won't fix the problem.

2. If I change the child lookup field to only allow one selection, then the child dropdown on the editForm.aspx works properly, meaning it can remember its initial value.

3. Both newForm and editForm can filter the child selections properly so the relationship setup seems correct to me.

4. The initial multi selected values briefly appeared in the child field selected value control on the editForm.aspx page but then get losted when the $(document).ready(function()... fully executed.

5. By accident when I broke the $(document).ready(function()... execution by leaving a comma at the end of the statement body of the $(document).ready(function()... , the initial selected values get retained in the selected value control of the child lookup multi field. This is what I want. However, the cascading is broken, meaning the available choices are not filtered at all although my parent lookup field is showing the selected value.

 

I hope the description is clear and makes sense to you. This is my first post here and I am not sure how to add a screen shot to my thread. Please help and let me know if any additional info you need to help us debug. I know every little about JQuery. This issue seems a flaw to the lookup child field allowing multi selections in $().SPServices.SPCascadeDropdowns.

<script language="javascript" type="text/javascript">
	$(document).ready(function() {
		$().SPServices.SPCascadeDropdowns({
			relationshipList: "BusinessSegment",
			relationshipListParentColumn: "KMUnit",
			relationshipListChildColumn: "Title",
			parentColumn: "KM Unit",
			childColumn: "Business Segment",
			//debug: false
		});
	});
</script>

Any help would be appriciated!

 

Yanli

 

 

Sep 6, 2011 at 12:32 PM

Hi,

I've just detected the same problem; exactly like described above by Yanli.

I realise that IE gives a JS error:

Message: 'length' is null or not an objetLine: 382Character: 17Code: 0URI: https://xxxxxxxxxxxx/_layouts/groupeditempicker.js?rev=ZW7trsQvnZ6YcAkyWgSXLA%3D%3D

So I understand there must be a problem with both JS execution.

 

Please, any help will be appreciated!

Sep 8, 2011 at 2:59 PM

Ok, solved using 1.5.2 jQuery version.

Don`t know why is failing with 1.6.2 version.

 

Thanks anyway!

Sep 8, 2011 at 5:07 PM
Thank you very much! I switched to 1.5.2 and the problem is gone. You rock!


From: [email removed]
To: [email removed]
Date: Thu, 8 Sep 2011 07:59:16 -0700
Subject: Re: SPCascadeDropdowns on EditForm.aspx followup [SPServices:271212]

From: smorollon
Ok, solved using 1.5.2 jQuery version.
Don`t know why is failing with 1.6.2 version.

Thanks anyway!
Read the full discussion online.
To add a post to this discussion, reply to this email (SPServices@discussions.codeplex.com)
To start a new discussion for this project, email SPServices@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com
Coordinator
Oct 23, 2011 at 3:42 AM

I've had several other reports of this since you posted. I'm going to try to reproduce it in my environment, but have not yet been able to do so. Watch this issue in the Issue Tracker if you'd like to see my progress:

http://spservices.codeplex.com/workitem/9333

M.

Coordinator
Nov 6, 2011 at 4:12 AM

I believe that I have a fix for this issue in v0.6.3ALPHA9. I'd appreciate it if you could test it out if you can.
http://spservices.codeplex.com/releases/view/68781

M.

Nov 6, 2011 at 6:21 PM
Ok, i'll try to check it out next week.
Regards.


El 06/11/2011, a las 05:12, "sympmarc" <notifications@codeplex.com> escribió:

From: sympmarc

I believe that I have a fix for this issue in v0.6.3ALPHA9. I'd appreciate it if you could test it out if you can.
http://spservices.codeplex.com/releases/view/68781

M.

Nov 7, 2011 at 10:13 PM
Edited Nov 7, 2011 at 10:17 PM

I have tested the ALPHA9 release and the bug still exists for me.  It seems to only happen though when there is only one choice for a drop down.  Here are two senarios to replicate this issue.

Scenario 1

 Parent Choice: Other

 Child Options: Other (This is the only option)

 SubChild Options: Other, Calling Card

 Result:  When the EditForm page reloads both the Child and SubChild options need to be re-selected.

 

Scenario 2

 Parent Choice: Security

 Child Options: Access, Account Locked Out, Employee, Other, Password Reset  (Password Reset is chosen for this scenario)

SubChild Options: None (this is the only choice when Password Reset is chosen)

Result: When the EditForm page reloads only the SubChild option need to be re-selected.

 

Enabling the selectSingleOption still brings up the error "Value is not among the set of valid lookup values." when trying to save the page.  

 

Here are the calls I am using:

 

<script language="javascript" type="text/javascript" src=" /_layouts/jQuery/jquery-1.3.2.min.js"></script>

<script language="javascript" type="text/javascript" src=" /_layouts/jQuery/jquery.SPServices-0.6.3ALPHA9.js"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
    relationshipList: "CategoriesSub1",
    relationshipListParentColumn: "Category",
    relationshipListChildColumn: "Title",
    parentColumn: "Ticket Category",
    childColumn: "Ticket SubCategory1",
    simpleChild: true,
    debug: true
  });
  $().SPServices.SPCascadeDropdowns({
    relationshipList: "CategoriesSub2",
    relationshipListParentColumn: "CategorySub1",
    relationshipListChildColumn: "Title",
    parentColumn: "Ticket SubCategory1",
    childColumn: "Ticket SubCategory2",
    simpleChild: true,
    debug: true
  });
});

</script>

Coordinator
Nov 8, 2011 at 12:16 AM
JT:

I see that you are using jQuery 1.3.2 below. I'd be surprised if much of SPServices worked with that version. Can you try 1.6+?

Thanks,
M.
Nov 8, 2011 at 1:43 AM
Edited Nov 8, 2011 at 1:46 AM

Okay here we go :)

 

.../jquery-1.6.2.min.js
.../jquery.SPServices-0.6.3ALPHA9.js

Nets the same results stated above

.../jquery-1.6.3.min.js
.../jquery.SPServices-0.6.3ALPHA9.js

Nets the same results stated above

.../jquery-1.6.4.js
.../jquery.SPServices-0.6.3ALPHA9.js

Nets the same results stated above

.../jquery-1.7.js
.../jquery.SPServices-0.6.3ALPHA9.js

Unable to select any option for child or SubChild Columns.  Seems as though the selection of the Parent is un-noticed.

 

 

Here is something interesting though...

 

<script language="javascript" type="text/javascript" src="/_layouts/JQuery/jquery-1.6.2.min.js"></script>
<script language="javascript" type="text/javascript" src=" /_layouts/jQuery/jquery.SPServices-0.6.3ALPHA9.js"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function() {
	$().SPServices.SPCascadeDropdowns({
		relationshipList: "CategoriesSub1",
		relationshipListParentColumn: "Category",
		relationshipListChildColumn: "Title",
		parentColumn: "Ticket Category",
		childColumn: "Ticket SubCategory1",
		debug: true
	});
	$().SPServices.SPCascadeDropdowns({
		relationshipList: "CategoriesSub2",
		relationshipListParentColumn: "CategorySub1",
		relationshipListChildColumn: "Title",
		parentColumn: "Ticket SubCategory1",
		childColumn: "Ticket SubCategory2",
		debug: true
	});
});
</script>

Removing "simpleChild: true" works perfectly.  The EditForm page "remembers" what values were previously chosen.  Unfortunately the complex drop downs are really not appealing.

 

Edit:

I did also try 1.5.2 as stated above but still in both scenarios the values were lost.

Coordinator
Nov 8, 2011 at 1:26 PM

Perhaps you're dealing with a different issue, then. Thanks for the thorough testing.

Can you simplify things a bit further so that we can isolate the issue? It sounds like the problem is with setting

simpleChild: true,

It also sounds like your issue exists regardless of the version of jQuery.

Are there any other details you can figure out? Anything about the number of values, the value text itself, etc.?

M.

Nov 8, 2011 at 11:49 PM

First of all, I want to say THANK YOU for providing an amazing library and also supporting it the way you are.

 

I think the issue is in the SPServices.SPComplexToSimpleDropdown function that gets called if(opt.simpleChild === true && childSelect.Type === "C").  But the catch is only when there is one choice to choose.  When I add that function call like so:

<script language="javascript" type="text/javascript" src="/_layouts/JQuery/jquery-1.6.2.min.js"></script>
<script language="javascript" type="text/javascript" src=" /_layouts/jQuery/jquery.SPServices-0.6.3ALPHA9.js"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function() {
	$().SPServices.SPCascadeDropdowns({
		relationshipList: "CategoriesSub1",
		relationshipListParentColumn: "Category",
		relationshipListChildColumn: "Title",
		parentColumn: "Ticket Category",
		childColumn: "Ticket SubCategory1",
		debug: true
	});
	$().SPServices.SPCascadeDropdowns({
		relationshipList: "CategoriesSub2",
		relationshipListParentColumn: "CategorySub1",
		relationshipListChildColumn: "Title",
		parentColumn: "Ticket SubCategory1",
		childColumn: "Ticket SubCategory2",
		debug: true
	});
	$().SPServices.SPComplexToSimpleDropdown({
		columnName: "Ticket SubCategory2",
		completefunc: null,
		debug: true
	});
});
</script>

My column choice is lost (But only if there was a single choice, the column value remains if there is more than one choice).  I really hope I am helping and not making things more confusing.