SPServices.SPCascadeDropdowns all values from the lookup list and also the filtered value in the dropdown

Jun 8, 2011 at 7:22 AM

I'm using SP2010, jquery.SPServices-0.6.1.min and jquery-1.6.1.min.

Also I have followed the description of the SPServices.SPCascadeDropdowns-documentation and have implemented the County, Region, State example.

In my cascading testlist I have defined the following lookup-fields:

  • Field CountryTest to the list countries.Title
  • Field RegionTest to the list region.Title
  • Field StateTest to the list states.Title

The challenge is now, that I  have too many values in the filtered dropdown fields.

  • First select in the field CountryTest the value Canada.
  • In the RegionTest there should be only "Eastern provinces" and "Western provinces". In my case there are the following values listed:
    • Camarque
    • Eastern Provinces
    • Midwest
    • Northeast
    • Paris
    • Southeast
    • Western Provinces
    • Choose RegionTest
    • Choose RegionTest
    • Eastern Provinces
    • Western Provinces

The last 3 items would be ok, but the values before are too much. Do you have any suggestion, how I should initalize the dropdown-field.

The same thing happens with the state field. First are listed all regions and after Choose StateTest the correct values are listed.

In the following lines you will find my definitions in the ctNewForm.aspx.

<script type="text/javascript" language="javascript" src="/softwarecomponents/jquery-1.6.1.min.js"></script>
<script type="text/javascript" language="javascript" src="/softwarecomponents/jquery.SPServices-0.6.1.min.js"></script>

<script type="text/javascript">
$(document).ready(function()
{
  $().SPServices.SPCascadeDropdowns(
  {
   relationshipList: "regions",
   relationshipListParentColumn: "Country",
   relationshipListChildColumn: "Title",
   parentColumn: "CountryTest",
   childColumn: "RegionTest",
   debug: true
  });
  
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "states",
   relationshipListParentColumn: "RegionState",
   relationshipListChildColumn: "Title",
   relationshipListSortColumn: "ID",
   parentColumn: "RegionTest",
   childColumn: "StateTest",
   debug: true
  });
});
</script>

I also tried out the alphaversion of your code. The result was the same.

Thanks a lot for your tip in advance.

best regards

Ritzo

SPD-Definitions for the lookup-fields in the ctNewForm.aspx. Here I haven't done any changes. They just are standards. I just copied these lines to complete all information for this discussion.

     <tr>
      <td width="190px" valign="top" class="ms-formlabel">
       <H3 class="ms-standardheader">
        <nobr>CountryTest</nobr>
       </H3>
      </td>
      <td width="400px" valign="top" class="ms-formbody">
       <SharePoint:FormField runat="server" id="ff4{$Pos}" ControlMode="New" FieldName="CountryTest" __designer:bind="{ddwrt:DataBind('i',concat('ff4',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@CountryTest')}"/>
       <SharePoint:FieldDescription runat="server" id="ff4description{$Pos}" FieldName="CountryTest" ControlMode="New"/>
      </td>
     </tr>
     <tr>
      <td width="190px" valign="top" class="ms-formlabel">
       <H3 class="ms-standardheader">
        <nobr>RegionTest</nobr>
       </H3>
      </td>
      <td width="400px" valign="top" class="ms-formbody">
       <SharePoint:FormField runat="server" id="ff5{$Pos}" ControlMode="New" FieldName="RegionTest" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@RegionTest')}"/>
       <SharePoint:FieldDescription runat="server" id="ff5description{$Pos}" FieldName="RegionTest" ControlMode="New"/>
      </td>
     </tr>
     <tr>
      <td width="190px" valign="top" class="ms-formlabel">
       <H3 class="ms-standardheader">
        <nobr>StateTest</nobr>
       </H3>
      </td>
      <td width="400px" valign="top" class="ms-formbody">
       <SharePoint:FormField runat="server" id="ff6{$Pos}" ControlMode="New" FieldName="StateTest" __designer:bind="{ddwrt:DataBind('i',concat('ff6',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@StateTest')}"/>
       <SharePoint:FieldDescription runat="server" id="ff6description{$Pos}" FieldName="StateTest" ControlMode="New"/>
      </td>
     </tr>

Coordinator
Jun 8, 2011 at 12:09 PM

Ritzo:

Everthing looks correct, but it sounds like the script just isn't running. Are you getting a script error in your browser? Usually the problem is just that the references to the script files are incorrect. See this blog post:
http://sympmarc.com/2011/05/03/adding-jquery-to-a-sharepoint-page-step-one-always/

M.

Jun 8, 2011 at 4:35 PM
Edited Jun 8, 2011 at 4:36 PM

Dear Marc

Thanks for your response. The script is working.

I already have put these lines in the script, which I found in the comment.

$(document).ready(function() 
{
alert ('jQuery on.');
var thisSite = $().SPServices.SPGetCurrentSite();
alert ('Hello World! Your site is : ' + thisSite );
$().SPServices.SPCascadeDropdowns( ….

 

Ritzo
Coordinator
Jun 13, 2011 at 12:33 PM

Sorry for the delay in getting back to you.

So the next question is what the data looks like in your relationshipLists. In the regions list, you should have a column called Country which is a lookup column to countries.Title.

Since you're simply trying to reproduce my demo case, this ought to just work. Are you working with a customized form or simply the standard LFWP with the script added to the page?

M.

Jun 16, 2011 at 2:52 PM

Hello Marc

Sorry for my delay.

Question 1: yes: in regions list I have a lookup column named Country to countries.Title. In the other list named test1 with the cascading lookup I also have lookups to countries and another lookup to regions. See below I put 2 tables with the field definitions. (red marked)

Question 2: I work with SPD2010 and copied the NewForm.aspx to ctNewForm.aspx and inserted your code. Save and Test

Thanks a lot for your response.

ritzo

 

Afterwards I  have tried to mention all my steps:

  • Create the 3 list named countries, regions, states based on a sharepoint custom list
    1. Definition of the list regions with column additional info, which I inserted.

Column (click to edit)

Type

Required

additional info

Title

Single line of text

 

 

Country

Lookup

 

countries.Title

Created By

Person or Group

 

 

Modified By

Person or Group

Bottom of Form

 

 

  1.  
    1. Content

Title

Country

Northeast

US

Southeast

US

Midwest

US

Mountain

US

Eastern Provinces

Canada

Western Provinces

Canada

Paris

France

Camarque

France

  • In the states list I have a lookup to the regions.Title
  • Create the 4th list named test1 as listed below. This List test1 is the baselist for the cascading fields.

Column (click to edit)

Type

Required

additional info

Title

Single line of text

 

 

Body

Multiple lines of text

 

 

Expires

Date and Time

 

 

CountryTest

Lookup

 

countries.Title

RegionTest

Lookup

 

regions.Title

StateTest

Lookup

 

states.State

Created By

Person or Group

 

 

Modified By

Person or Group

Bottom of Form

 

 

  • Open the test1-List with sharepoint designer2010 (spd2010)
  • Create a new form e.g. ctNewForm.aspx in SPD2010 and open this form in advanced edit mode
  • copy all the form-definition from NewForm.aspx to this page ctNewForm.aspx.
  •  Insert your code after the main-clause (it's marked red in the pade-definition at the end.
  • Save and open in browser
  • Test and I have the all entries and additional the filtered values.
    • I also recognized, that if I change the country-value for e.g. from canada to france, then the values are all regions plus choose RegionsTest and all canada plus choose Regionstest with all france regions. e.g.
      • (none)
      • Camarque
      • EasternProvinces
      • Midwest
      • Mountain
      • Northeast
      • Paris
      • Southeast
      • Western Provinces
      • Choose RegionTest   --> The "Choose RegionTest" really comes twice)
      • Choose RegionTest
      • Eastern Provinces
      • Western Provinces
      • Choose RegionTest
      • Camarque
      • Paris

 

Here you will find the whole page-definition from ctNewForm.aspx

<%@ Page language="C#" MasterPageFile="~masterurl/default.master"    Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" meta:progid="SharePoint.WebPartPage.Document" meta:webpartpageexpansion="full"  %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.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">
 <span class="die">
 <SharePoint:ListProperty Property="LinkTitle" runat="server" id="ID_LinkTitle"/>
 : </span>
 <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" >
<SharePoint:UIVersionedContent UIVersion="4" runat="server">
 <ContentTemplate>
    <div class="ms-quicklaunchouter">
    <div class="ms-quickLaunch">
    <SharePoint:UIVersionedContent UIVersion="3" runat="server">
     <ContentTemplate>
      <h3 class="ms-standardheader"><label class="ms-hidden"><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,quiklnch_pagetitle%>" EncodeMethod="HtmlEncode"/></label>
      <Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="ViewFormPages">
       <div class="ms-quicklaunchheader"><SharePoint:SPLinkButton id="idNavLinkViewAll" runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" Text="<%$Resources:wss,quiklnch_allcontent%>" accesskey="<%$Resources:wss,quiklnch_allcontent_AK%>"/></div>
      </SharePoint:SPSecurityTrimmedControl>
      </h3>
     </ContentTemplate>
    </SharePoint:UIVersionedContent>
    <Sharepoint:SPNavigationManager
    id="QuickLaunchNavigationManager"
    runat="server"
    QuickLaunchControlId="QuickLaunchMenu"
    ContainedControl="QuickLaunch"
    EnableViewState="false"
    CssClass="ms-quicklaunch-navmgr"
    >
    <div>
     <SharePoint:DelegateControl runat="server" ControlId="QuickLaunchDataSource">
      <Template_Controls>
      <asp:SiteMapDataSource SiteMapProvider="SPNavigationProvider" ShowStartingNode="False" id="QuickLaunchSiteMap" StartingNodeUrl="sid:1025" runat="server" />
      </Template_Controls>
     </SharePoint:DelegateControl>
     <SharePoint:UIVersionedContent UIVersion="3" runat="server">
      <ContentTemplate>
       <SharePoint:AspMenu id="QuickLaunchMenu" runat="server" DataSourceId="QuickLaunchSiteMap" Orientation="Vertical" StaticDisplayLevels="2" ItemWrap="true" MaximumDynamicDisplayLevels="0" StaticSubMenuIndent="0" SkipLinkText="" CssClass="s4-die">
        <LevelMenuItemStyles>
         <asp:menuitemstyle CssClass="ms-navheader" />
         <asp:menuitemstyle CssClass="ms-navitem" />
        </LevelMenuItemStyles>
        <LevelSubMenuStyles>
         <asp:submenustyle CssClass="ms-navSubMenu1" />
         <asp:submenustyle CssClass="ms-navSubMenu2" />
        </LevelSubMenuStyles>
        <LevelSelectedStyles>
         <asp:menuitemstyle CssClass="ms-selectednavheader" />
         <asp:menuitemstyle CssClass="ms-selectednav" />
        </LevelSelectedStyles>
       </SharePoint:AspMenu>
      </ContentTemplate>
     </SharePoint:UIVersionedContent>
     <SharePoint:UIVersionedContent UIVersion="4" runat="server">
      <ContentTemplate>
       <SharePoint:AspMenu id="V4QuickLaunchMenu" runat="server" EnableViewState="false" DataSourceId="QuickLaunchSiteMap" UseSimpleRendering="true" Orientation="Vertical" StaticDisplayLevels="2" MaximumDynamicDisplayLevels="0" SkipLinkText="" CssClass="s4-ql" />
      </ContentTemplate>
     </SharePoint:UIVersionedContent>
    </div>
    </Sharepoint:SPNavigationManager>
   <Sharepoint:UIVersionedContent runat="server" UIVersion="3">
    <ContentTemplate>
     <Sharepoint:SPNavigationManager
     id="TreeViewNavigationManager"
     runat="server"
     ContainedControl="TreeView"
     >
       <table class="ms-navSubMenu1" cellpadding="0" cellspacing="0" border="0">
      <tr>
        <td>
       <table class="ms-navheader" width="100%" cellpadding="0" cellspacing="0" border="0">
         <tr>
        <td nowrap="nowrap" id="idSiteHierarchy">
          <SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" id="idNavLinkSiteHierarchy" Text="<%$Resources:wss,treeview_header%>" accesskey="<%$Resources:wss,quiklnch_allcontent_AK%>"/>
        </td>
         </tr>
       </table>
        </td>
      </tr>
       </table>
       <div class="ms-treeviewouter">
      <SharePoint:DelegateControl runat="server" ControlId="TreeViewAndDataSource">
        <Template_Controls>
       <SharePoint:SPHierarchyDataSourceControl
        runat="server"
        id="TreeViewDataSource"
        RootContextObject="Web"
        IncludeDiscussionFolders="true"
       />
       <SharePoint:SPRememberScroll runat="server" id="TreeViewRememberScroll" onscroll="javascript:_spRecordScrollPositions(this);" style="overflow: auto;height: 400px;width: 150px; ">
         <Sharepoint:SPTreeView
        id="WebTreeView"
        runat="server"
        ShowLines="false"
        DataSourceId="TreeViewDataSource"
        ExpandDepth="0"
        SelectedNodeStyle-CssClass="ms-tvselected"
        NodeStyle-CssClass="ms-navitem"
        NodeStyle-HorizontalPadding="2"
        SkipLinkText=""
        NodeIndent="12"
        ExpandImageUrl="/_layouts/images/tvplus.gif"
        CollapseImageUrl="/_layouts/images/tvminus.gif"
        NoExpandImageUrl="/_layouts/images/tvblank.gif"
         >
         </Sharepoint:SPTreeView>
       </Sharepoint:SPRememberScroll>
        </Template_Controls>
      </SharePoint:DelegateControl>
       </div>
     </Sharepoint:SPNavigationManager>
    </ContentTemplate>
   </SharePoint:UIVersionedContent>
   <Sharepoint:UIVersionedContent runat="server" UIVersion="4">
    <ContentTemplate>
     <Sharepoint:SPNavigationManager
     id="TreeViewNavigationManagerV4"
     runat="server"
     ContainedControl="TreeView"
     CssClass="s4-treeView"
     >
       <SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" id="idNavLinkSiteHierarchyV4" Text="<%$Resources:wss,treeview_header%>" accesskey="<%$Resources:wss,quiklnch_allcontent_AK%>" CssClass="s4-qlheader" />
        <div class="ms-treeviewouter">
       <SharePoint:DelegateControl runat="server" ControlId="TreeViewAndDataSource">
         <Template_Controls>
        <SharePoint:SPHierarchyDataSourceControl
         runat="server"
         id="TreeViewDataSourceV4"
         RootContextObject="Web"
         IncludeDiscussionFolders="true"
        />
        <SharePoint:SPRememberScroll runat="server" id="TreeViewRememberScrollV4" onscroll="javascript:_spRecordScrollPositions(this);" style="overflow: auto;height: 400px;width: 155px; ">
          <Sharepoint:SPTreeView
         id="WebTreeViewV4"
         runat="server"
         ShowLines="false"
         DataSourceId="TreeViewDataSourceV4"
         ExpandDepth="0"
         SelectedNodeStyle-CssClass="ms-tvselected"
         NodeStyle-CssClass="ms-navitem"
         SkipLinkText=""
         NodeIndent="12"
         ExpandImageUrl="/_layouts/images/tvclosed.png"
         ExpandImageUrlRtl="/_layouts/images/tvclosedrtl.png"
         CollapseImageUrl="/_layouts/images/tvopen.png"
         CollapseImageUrlRtl="/_layouts/images/tvopenrtl.png"
         NoExpandImageUrl="/_layouts/images/tvblank.gif"
          >
          </Sharepoint:SPTreeView>
        </Sharepoint:SPRememberScroll>
         </Template_Controls>
       </SharePoint:DelegateControl>
        </div>
     </Sharepoint:SPNavigationManager>
    </ContentTemplate>
   </SharePoint:UIVersionedContent>
    <SharePoint:UIVersionedContent UIVersion="3" runat="server" id="PlaceHolderQuickLaunchBottomV3">
     <ContentTemplate>
      <table width="100%" cellpadding="0" cellspacing="0" border="0" class="s4-die">
      <tbody>
      <tr><td>
      <table class="ms-recyclebin" width="100%" cellpadding="0" cellspacing="0" border="0">
      <tbody>
      <tr><td nowrap="nowrap">
      <SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/recyclebin.aspx" id="v3idNavLinkRecycleBin" ImageUrl="/_layouts/images/recycbin.gif" Text="<%$Resources:wss,StsDefault_RecycleBin%>" PermissionsString="DeleteListItems" />
      </td></tr>
      </table>
      </td></tr>
      </table>
     </ContentTemplate>
    </SharePoint:UIVersionedContent>
    <SharePoint:UIVersionedContent UIVersion="4" runat="server" id="PlaceHolderQuickLaunchBottomV4">
     <ContentTemplate>
      <ul class="s4-specialNavLinkList">
       <li>
        <SharePoint:ClusteredSPLinkButton
         runat="server"
         NavigateUrl="~site/_layouts/recyclebin.aspx"
         ImageClass="s4-specialNavIcon"
         ImageUrl="/_layouts/images/fgimg.png"
         ImageWidth=16
         ImageHeight=16
         OffsetX=0
         OffsetY=428
         id="idNavLinkRecycleBin"
         Text="<%$Resources:wss,StsDefault_RecycleBin%>"
         CssClass="s4-rcycl"
         PermissionsString="DeleteListItems" />
       </li>
       <li>
        <SharePoint:ClusteredSPLinkButton
         id="idNavLinkViewAllV4"
         runat="server"
         PermissionsString="ViewFormPages"
         NavigateUrl="~site/_layouts/viewlsts.aspx"
         ImageClass="s4-specialNavIcon"
         ImageUrl="/_layouts/images/fgimg.png"
         ImageWidth=16
         ImageHeight=16
         OffsetX=0
         OffsetY=0
         Text="<%$Resources:wss,quiklnch_allcontent_short%>"
         accesskey="<%$Resources:wss,quiklnch_allcontent_AK%>"/>
       </li>
      </ul>
     </ContentTemplate>
    </SharePoint:UIVersionedContent>
    </div>
    </div>
 </ContentTemplate>
</SharePoint:UIVersionedContent>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

<script type="text/javascript" language="javascript" src="/softwarecomponents/jquery-1.6.1.min.js"></script>
<script type="text/javascript" language="javascript" src="/softwarecomponents/jquery.SPServices-0.6.1.min.js"></script>

//Hello world. This is a quick script for new users to see if everything is
working ok:
<script type="text/javascript">
//alert ("js on.");
$(document).ready(function()
{
  alert ('jQuery on.');
  var thisSite = $().SPServices.SPGetCurrentSite();
  alert ('Hello World! Your site is : ' + thisSite );

  $().SPServices.SPCascadeDropdowns(
  {
   relationshipList: "regions",
   relationshipListParentColumn: "Country",
   relationshipListChildColumn: "Title",
   parentColumn: "CountryTest",
   childColumn: "RegionTest",
   debug: true
  });
  
  $().SPServices.SPCascadeDropdowns({
     relationshipList: "states",
     relationshipListParentColumn: "RegionState",
     relationshipListChildColumn: "Title",
     relationshipListSortColumn: "ID",
     parentColumn: "RegionTest",
     childColumn: "StateTest",
     debug: true
    });
});
</script>


<SharePoint:UIVersionedContent UIVersion="4" runat="server">
 <ContentTemplate>
 <div style="padding-left:5px">
 </ContentTemplate>
</SharePoint:UIVersionedContent>
 <table cellpadding="0" cellspacing="0" id="onetIDListForm" style="width:100%">
  <tr>
   <td>
  <WebPartPages:WebPartZone runat="server" FrameType="None" ID="Main" Title="loc:Main"><ZoneTemplate>
  <WebPartPages:DataFormWebPart runat="server" Description="" PartOrder="2" Default="FALSE" HelpLink="" AllowRemove="True" IsVisible="True" AllowHide="True" UseSQLDataSourcePaging="True" ExportControlledProperties="True" DataSourceID="" Title="TestCascade" ViewFlag="8" NoDefaultStyle="TRUE" AllowConnect="True" DisplayName="TestCascade" PageType="PAGE_NEWFORM" FrameState="Normal" PageSize="-1" PartImageLarge="" AsyncRefresh="False" ExportMode="All" Dir="Default" DetailLink="" ShowWithSampleData="False" ListId="35c76a47-89b9-4793-b8c1-c549d70f0d8b" ListName="{35C76A47-89B9-4793-B8C1-C549D70F0D8B}" FrameType="None" PartImageSmall="" IsIncluded="True" SuppressWebPartChrome="False" AllowEdit="True" ManualRefresh="False" ChromeType="None" AutoRefresh="False" AutoRefreshInterval="60" AllowMinimize="True" ViewContentTypeId="" InitialAsyncDataFetch="False" MissingAssembly="Cannot import this Web Part." HelpMode="Modeless" ID="g_b73b5872_e178_42d1_b186_70a444986202" ConnectionID="00000000-0000-0000-0000-000000000000" AllowZoneChange="True" IsIncludedFilter="" __MarkupType="vsattributemarkup" __WebPartId="{8FC967B7-BA94-4523-8B17-45C67111D015}" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""><ParameterBindings>
   <ParameterBinding Name="ListItemId" Location="QueryString(ID)" DefaultValue="0"/>
   <ParameterBinding Name="weburl" Location="None" DefaultValue="http://gotthard/devmb"/>
   <ParameterBinding Name="ListID" Location="None" DefaultValue="{35C76A47-89B9-4793-B8C1-C549D70F0D8B}"/>
   <ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
   <ParameterBinding Name="ManualRefresh" Location="WPProperty[ManualRefresh]"/>
   <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
   <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
  </ParameterBindings>
<DataFields>
</DataFields>
<Xsl>

 

 


<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
 <xsl:output method="html" indent="no"/>
 <xsl:decimal-format NaN=""/>
 <xsl:param name="dvt_apos">&apos;</xsl:param>
 <xsl:param name="ManualRefresh"></xsl:param>
 <xsl:variable name="dvt_1_automode">0</xsl:variable>
 <xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls">
  <xsl:choose>
   <xsl:when test="($ManualRefresh = 'True')">
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
     <tr>
      <td valign="top">
       <xsl:call-template name="dvt_1"/>
      </td>
      <td width="1%" class="ms-vb" valign="top">
       <img src="/_layouts/images/staticrefresh.gif" id="ManualRefresh" border="0" onclick="javascript: {ddwrt:GenFireServerEvent('__cancel')}" alt="Click here to refresh the dataview."/>
      </td>
     </tr>
    </table>
   </xsl:when>
   <xsl:otherwise>
    <xsl:call-template name="dvt_1"/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>
 
 <xsl:template name="dvt_1">
  <xsl:variable name="dvt_StyleName">ListForm</xsl:variable>
  <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
  <div>
   <span id="part1">
    <table border="0" width="100%">
     <xsl:call-template name="dvt_1.body">
      <xsl:with-param name="Rows" select="$Rows"/>
     </xsl:call-template>
    </table>
   </span>
   <SharePoint:AttachmentUpload runat="server" ControlMode="New"/>
   <SharePoint:ItemHiddenVersion runat="server" ControlMode="New"/>
  </div>
 </xsl:template>
 <xsl:template name="dvt_1.body">
  <xsl:param name="Rows"/>
  <tr>
   <td class="ms-toolbar" nowrap="nowrap">
    <table>
     <tr>
      <td width="99%" class="ms-toolbar" nowrap="nowrap"><IMG SRC="/_layouts/images/blank.gif" width="1" height="18"/>Das ist ctNewForm</td>
      <td class="ms-toolbar" nowrap="nowrap">
       <SharePoint:SaveButton runat="server" ControlMode="New" id="savebutton1"/>
      </td>
      <td class="ms-separator">
       
      </td>
      <td class="ms-toolbar" nowrap="nowrap" align="right">
       <SharePoint:GoBackButton runat="server" ControlMode="New" id="gobackbutton1"/>
      </td>
     </tr>
    </table>
   </td>
  </tr>
  <tr>
   <td class="ms-toolbar" nowrap="nowrap">
    <SharePoint:FormToolBar runat="server" ControlMode="New"/>
   </td>
  </tr>
  <xsl:call-template name="dvt_1.rowedit"/>
  <tr>
   <td class="ms-toolbar" nowrap="nowrap">
    <table>
     <tr>
      <td width="99%" class="ms-toolbar" nowrap="nowrap"><IMG SRC="/_layouts/images/blank.gif" width="1" height="18"/></td>
      <td class="ms-toolbar" nowrap="nowrap">
       <SharePoint:SaveButton runat="server" ControlMode="New" id="savebutton2"/>
      </td>
      <td class="ms-separator">
       
      </td>
      <td class="ms-toolbar" nowrap="nowrap" align="right">
       <SharePoint:GoBackButton runat="server" ControlMode="New" id="gobackbutton2"/>
      </td>
     </tr>
    </table>
   </td>
  </tr>
 </xsl:template>
 <xsl:template name="dvt_1.rowedit">
  <xsl:param name="Pos" select="position()"/>
  <tr>
   <td>
    <table border="0" cellspacing="0" width="100%">
     <tr>
      <td width="190px" valign="top" class="ms-formlabel">
       <H3 class="ms-standardheader">
        <nobr>Title<span class="ms-formvalidation"> *</span>
        </nobr>
       </H3>
      </td>
      <td width="400px" valign="top" class="ms-formbody">
       <SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="New" FieldName="Title" __designer:bind="{ddwrt:DataBind('i',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}"/>
       <SharePoint:FieldDescription runat="server" id="ff1description{$Pos}" FieldName="Title" ControlMode="New"/>
      </td>
     </tr>
     <tr>
      <td width="190px" valign="top" class="ms-formlabel">
       <H3 class="ms-standardheader">
        <nobr>Body</nobr>
       </H3>
      </td>
      <td width="400px" valign="top" class="ms-formbody">
       <SharePoint:FormField runat="server" id="ff2{$Pos}" ControlMode="New" FieldName="Body" __designer:bind="{ddwrt:DataBind('i',concat('ff2',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Body')}"/>
       <SharePoint:FieldDescription runat="server" id="ff2description{$Pos}" FieldName="Body" ControlMode="New"/>
      </td>
     </tr>
     <tr>
      <td width="190px" valign="top" class="ms-formlabel">
       <H3 class="ms-standardheader">
        <nobr>Expires</nobr>
       </H3>
      </td>
      <td width="400px" valign="top" class="ms-formbody">
       <SharePoint:FormField runat="server" id="ff3{$Pos}" ControlMode="New" FieldName="Expires" __designer:bind="{ddwrt:DataBind('i',concat('ff3',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Expires')}"/>
       <SharePoint:FieldDescription runat="server" id="ff3description{$Pos}" FieldName="Expires" ControlMode="New"/>
      </td>
     </tr>
     <tr>
      <td width="190px" valign="top" class="ms-formlabel">
       <H3 class="ms-standardheader">
        <nobr>CountryTest</nobr>
       </H3>
      </td>
      <td width="400px" valign="top" class="ms-formbody">
       <SharePoint:FormField runat="server" id="ff4{$Pos}" ControlMode="New" FieldName="CountryTest" __designer:bind="{ddwrt:DataBind('i',concat('ff4',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@CountryTest')}"/>
       <SharePoint:FieldDescription runat="server" id="ff4description{$Pos}" FieldName="CountryTest" ControlMode="New"/>
      </td>
     </tr>
     <tr>
      <td width="190px" valign="top" class="ms-formlabel">
       <H3 class="ms-standardheader">
        <nobr>RegionTest</nobr>
       </H3>
      </td>
      <td width="400px" valign="top" class="ms-formbody">
       <SharePoint:FormField runat="server" id="ff5{$Pos}" ControlMode="New" FieldName="RegionTest" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@RegionTest')}"/>
       <SharePoint:FieldDescription runat="server" id="ff5description{$Pos}" FieldName="RegionTest" ControlMode="New"/>
      </td>
     </tr>
     <tr>
      <td width="190px" valign="top" class="ms-formlabel">
       <H3 class="ms-standardheader">
        <nobr>StateTest</nobr>
       </H3>
      </td>
      <td width="400px" valign="top" class="ms-formbody">
       <SharePoint:FormField runat="server" id="ff6{$Pos}" ControlMode="New" FieldName="StateTest" __designer:bind="{ddwrt:DataBind('i',concat('ff6',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@StateTest')}"/>
       <SharePoint:FieldDescription runat="server" id="ff6description{$Pos}" FieldName="StateTest" ControlMode="New"/>
      </td>
     </tr>
     <tr id="idAttachmentsRow">
      <td nowrap="true" valign="top" class="ms-formlabel" width="20%">
       <SharePoint:FieldLabel ControlMode="New" FieldName="Attachments" runat="server"/>
      </td>
      <td valign="top" class="ms-formbody" width="80%">
       <SharePoint:FormField runat="server" id="AttachmentsField" ControlMode="New" FieldName="Attachments" __designer:bind="{ddwrt:DataBind('i','AttachmentsField','Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Attachments')}"/>
       <script>
          var elm = document.getElementById(&quot;idAttachmentsTable&quot;);
          if (elm == null || elm.rows.length == 0)
          document.getElementById(&quot;idAttachmentsRow&quot;).style.display=&apos;none&apos;;
        </script>
      </td>
     </tr>
     <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
      <tr>
       <td colspan="99" class="ms-vb">
        <span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:EscapeDelims(string(@ID))" ddwrt:ammode="view"></span>
       </td>
      </tr>
     </xsl:if>
    </table>
   </td>
  </tr>
 </xsl:template>
</xsl:stylesheet> </Xsl>
<DataSources>
<SharePoint:SPDataSource runat="server" DataSourceMode="ListItem" SelectCommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&quot;ContentType&quot;/&gt;&lt;Value Type=&quot;Text&quot;&gt;Announcement&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;" UseInternalName="True" UseServerDataFormat="True"><SelectParameters><WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0" Name="ListItemId"></WebPartPages:DataFormParameter><WebPartPages:DataFormParameter ParameterKey="weburl" PropertyName="ParameterValues" DefaultValue="http://gotthard/devmb" Name="weburl"></WebPartPages:DataFormParameter><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{35C76A47-89B9-4793-B8C1-C549D70F0D8B}" Name="ListID"></WebPartPages:DataFormParameter>
</SelectParameters><UpdateParameters><WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0" Name="ListItemId"></WebPartPages:DataFormParameter><WebPartPages:DataFormParameter ParameterKey="weburl" PropertyName="ParameterValues" DefaultValue="http://gotthard/devmb" Name="weburl"></WebPartPages:DataFormParameter><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{35C76A47-89B9-4793-B8C1-C549D70F0D8B}" Name="ListID"></WebPartPages:DataFormParameter>
</UpdateParameters><InsertParameters><WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0" Name="ListItemId"></WebPartPages:DataFormParameter><WebPartPages:DataFormParameter ParameterKey="weburl" PropertyName="ParameterValues" DefaultValue="http://gotthard/devmb" Name="weburl"></WebPartPages:DataFormParameter><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{35C76A47-89B9-4793-B8C1-C549D70F0D8B}" Name="ListID"></WebPartPages:DataFormParameter>
</InsertParameters><DeleteParameters><WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0" Name="ListItemId"></WebPartPages:DataFormParameter><WebPartPages:DataFormParameter ParameterKey="weburl" PropertyName="ParameterValues" DefaultValue="http://gotthard/devmb" Name="weburl"></WebPartPages:DataFormParameter><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{35C76A47-89B9-4793-B8C1-C549D70F0D8B}" Name="ListID"></WebPartPages:DataFormParameter>
</DeleteParameters>
</SharePoint:SPDataSource>
</DataSources>
</WebPartPages:DataFormWebPart>

</ZoneTemplate></WebPartPages:WebPartZone>
  <img src="/_layouts/images/blank.gif" width='590' height='1' alt="" />
   </td>
  </tr>
 </table>
<SharePoint:UIVersionedContent UIVersion="4" runat="server">
 <ContentTemplate>
 </div>
 </ContentTemplate>
</SharePoint:UIVersionedContent>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
 <SharePoint:UIVersionedContent UIVersion="4" runat="server"><ContentTemplate>
  <SharePoint:CssRegistration Name="forms.css" runat="server"/>
 </ContentTemplate></SharePoint:UIVersionedContent>
</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 type="text/javascript" id="onetidPageTitleAreaFrameScript">
 if (document.getElementById("onetidPageTitleAreaFrame") != null)
 {
  document.getElementById("onetidPageTitleAreaFrame").className="ms-areaseparator";
 }
</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"/>

Coordinator
Jun 16, 2011 at 8:21 PM
Edited Jun 16, 2011 at 8:22 PM

I'm still not sure what's going on. Since you're basically recreating the example (though you've named columns differently), it just ought to work.

One suggestion would be to strip things down to just the Country and Region and get that working, then layer in the States.

M.

Jul 7, 2011 at 6:57 AM

Hello Marc

In my opition the function is working correctly on the base, this means, if I select an item in the country drop down list, the depending values are listed in the region drop down list at the end of the list. But it seems to me, that each selection I do in the country drop down list, the values in the region drop down list are appending. The problem seems to me, that the drop down values in the region are too much. Is there a way to initialize the value of the depending drop down list region after I choose a country

  1. Select a Country
  2. Initalize the region list and add the depending values base on the choice in the country field.
  3. Choose Region

Thanks a log for your support

Ritzo

 

 

 

 

 

Coordinator
Jul 7, 2011 at 2:19 PM

Ritzo:

What you're describing is exactly how this is supposed to work. I'm still not sure what's happening on your end.

M.

Coordinator
Jul 7, 2011 at 2:21 PM

Actually, one other thought. Versions of SPServices prior to v0.6.2 don't work with jQuery 1.6+ (as clearly stated on the home page). Try v0.6.2.

M.

Jul 7, 2011 at 4:53 PM

Yeaap, your great.

With 0.6.2 it works perfect. Thanks a lot

Ritzo