Hi Guys,
As a new member of this site I figured I should do some practice or replication of something that looks easy and was somewhat relevant to what I want to accomplish in our SP 2007 site. And thus, I chose the cascading drop down as a first exploration project. Getting this project working should help me get a better understanding on how to use the tools in this site.
What I did was, create 3 Lists. Cascading List, Parents, Children.
Parents List has a title field containing values Father 1-4 and Mother 1 - 4,
Children List has a title field containing Son 1 -8 and Daughter 1-8, and a Parent Field look up to the Parents List.
2 Sons was assigned to each Father and 2 Daughters assigned to each Mother.
ie: Son 1 and 2 was assigned to Father 1, Son 3 and 4 was assigned to Father 2, ...,... ,
Daughter 7 and 8 was assigned to Mother 4
Cascading List contains a Title field renamed to Family, Parent Field looking up to the Title of the Parents list, a Child field looking up to the Title of the Children List
I created a copy of the New Item form of the cascading list and pasted and edited the code into the ASPX file.
Code:
relationshipList: "{7691E83F-09AA-4025-B9D3-F50922769E97}" = The Children List ID
relationshipListParentColumn: "Parent" = The Parent column under Children List
relationshipListChildColumn: "Title" = The Title Column under Children List also contains Son and Daughters 1 -8.
CAMLQuery:"<Eq><FieldRef Name='Parent'/><Value Type='Text'>"+CurrentValue+"</Value></Eq>",
For CAML Query I used Field Ref Name Parent thinking that it will determine the value of the dropdowns available for the Child field lookup
This might be a bit optimistic but am I closer to the truth with what I'm doing here or am I already lost that I am now at a different dimension.
As a new member of this site I figured I should do some practice or replication of something that looks easy and was somewhat relevant to what I want to accomplish in our SP 2007 site. And thus, I chose the cascading drop down as a first exploration project. Getting this project working should help me get a better understanding on how to use the tools in this site.
What I did was, create 3 Lists. Cascading List, Parents, Children.
Parents List has a title field containing values Father 1-4 and Mother 1 - 4,
Children List has a title field containing Son 1 -8 and Daughter 1-8, and a Parent Field look up to the Parents List.
2 Sons was assigned to each Father and 2 Daughters assigned to each Mother.
ie: Son 1 and 2 was assigned to Father 1, Son 3 and 4 was assigned to Father 2, ...,... ,
Daughter 7 and 8 was assigned to Mother 4
Cascading List contains a Title field renamed to Family, Parent Field looking up to the Title of the Parents list, a Child field looking up to the Title of the Children List
I created a copy of the New Item form of the cascading list and pasted and edited the code into the ASPX file.
Code:
<%@ Page language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
<SharePoint:ListFormPageTitle runat="server"/>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
<SharePoint:ListProperty Property="LinkTitle" runat="server" id="ID_LinkTitle"/>
:
<SharePoint:ListItemProperty id="ID_ItemProperty" MaxLength=40 runat="server"/>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server">
<IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt="">
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"/>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<table cellpadding=0 cellspacing=0 id="onetIDListForm">
<tr>
<td>
<WebPartPages:WebPartZone runat="server" FrameType="None" ID="Main" Title="loc:Main"><ZoneTemplate>
<WebPartPages:ListFormWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{8C1ABBF4-EF9D-4FE2-8C62-F07A46FC10A8}" >
<WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
<Title>Cascading List 2</Title>
<FrameType>Default</FrameType>
<Description />
<IsIncluded>true</IsIncluded>
<PartOrder>1</PartOrder>
<FrameState>Normal</FrameState>
<Height />
<Width />
<AllowRemove>true</AllowRemove>
<AllowZoneChange>true</AllowZoneChange>
<AllowMinimize>true</AllowMinimize>
<AllowConnect>true</AllowConnect>
<AllowEdit>true</AllowEdit>
<AllowHide>true</AllowHide>
<IsVisible>true</IsVisible>
<DetailLink />
<HelpLink />
<HelpMode>Modeless</HelpMode>
<Dir>Default</Dir>
<PartImageSmall />
<MissingAssembly>Cannot import this Web Part.</MissingAssembly>
<PartImageLarge />
<IsIncludedFilter />
<ExportControlledProperties>true</ExportControlledProperties>
<ConnectionID>00000000-0000-0000-0000-000000000000</ConnectionID>
<ID>g_8c1abbf4_ef9d_4fe2_8c62_f07a46fc10a8</ID>
<ListName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">{AD305392-38C3-4305-A198-FA4069B1573F}</ListName>
<ListItemId xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">0</ListItemId>
<ControlMode xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">New</ControlMode>
<TemplateName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">ListForm</TemplateName>
<FormType xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">8</FormType>
<ViewFlag xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">1048576</ViewFlag>
</WebPart>
</WebPartPages:ListFormWebPart>
</ZoneTemplate></WebPartPages:WebPartZone>
<IMG SRC="/_layouts/images/blank.gif" width=590 height=1 alt="">
</td>
</tr>
</table><
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderTitleLeftBorder" runat="server">
<table cellpadding=0 height=100% width=100% cellspacing=0>
<tr><td class="ms-areaseparatorleft"><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></td></tr>
</table>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderTitleAreaClass" runat="server">
<script id="onetidPageTitleAreaFrameScript">
document.getElementById("onetidPageTitleAreaFrame").className="ms-areaseparator";
</script>
__<script language="javascript" type="text/javascript" src="../../JQueryLibraries/jquery.SPServices-2013.01.js"></script>
<script language="javascript" type="text/javascript" src="../../JQueryLibraries/jquery.SPServices-2013.01.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$().SPServices.SPCascadeDropdowns({
relationshipList: "{7691E83F-09AA-4025-B9D3-F50922769E97}",
relationshipListParentColumn: "Parent",
relationshipListChildColumn: "Title",
CAMLQuery:"<Eq><FieldRef Name='Parent'/><Value Type='Text'>"+CurrentValue+"</Value></Eq>",
parentColumn: "Parent",
childColumn: "Child",
debug: true
});
});
</script>
__
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderBodyAreaClass" runat="server">
<style type="text/css">
.ms-bodyareaframe {
padding: 8px;
border: none;
}
</style>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderBodyLeftBorder" runat="server">
<div class='ms-areaseparatorleft'><IMG SRC="/_layouts/images/blank.gif" width=8 height=100% alt=""></div>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderTitleRightMargin" runat="server">
<div class='ms-areaseparatorright'><IMG SRC="/_layouts/images/blank.gif" width=8 height=100% alt=""></div>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderBodyRightMargin" runat="server">
<div class='ms-areaseparatorright'><IMG SRC="/_layouts/images/blank.gif" width=8 height=100% alt=""></div>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderTitleAreaSeparator" runat="server"/>
Form being edited was the Cascading List new item formrelationshipList: "{7691E83F-09AA-4025-B9D3-F50922769E97}" = The Children List ID
relationshipListParentColumn: "Parent" = The Parent column under Children List
relationshipListChildColumn: "Title" = The Title Column under Children List also contains Son and Daughters 1 -8.
CAMLQuery:"<Eq><FieldRef Name='Parent'/><Value Type='Text'>"+CurrentValue+"</Value></Eq>",
For CAML Query I used Field Ref Name Parent thinking that it will determine the value of the dropdowns available for the Child field lookup
This might be a bit optimistic but am I closer to the truth with what I'm doing here or am I already lost that I am now at a different dimension.