必填字段/ FieldRef内容类型无法正确使用货币

时间:2011-08-31 14:10:42

标签: sharepoint

我在ContentType xml中为货币字段指定了以下字段。内容类型中的任何其他必填字段与此列表栏的预期工作方式相同,但未按要求显示。我真的看不出有什么问题,有人可以帮忙吗?

<Field ID="{060e50ac-e9c1-4d3c-b1f9-de0bcac300f6}" Name="Price" DisplayName="Price" Type="Currency" Decimals="2" Min="0" Required="TRUE" Group="MyGroup" ColName="Price"/>

...

<ContentType ID="0x01000a35b7a7e98c46248e063d79ddd67f6c"
           Name="MarketPlaceContentType"
           Group="MyGroup"
           Description="Market place item, holds Title, Description, Category etc"
           Inherits="FALSE"
           Overwrite="TRUE"
           Version="0">


<FieldRef ID="{060E50AC-E9C1-4D3C-B1F9-DE0BCAC300F6}" Name="Price" DisplayName="Price" Required="TRUE" />    

2 个答案:

答案 0 :(得分:1)

我正在与Burt合作,可以在这个问题上分享更多的亮点,对我们做错的指导会很棒!!

1)我们已经创建了一种内容类型。

E.g

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

    <Field ID="{060e50ac-e9c1-4d3c-b1f9-de0bcac300f6}" Name="Price" DisplayName="Price" Type="Text" Required="False" Group="" ColName="Price" StaticName="Price" />

    <!-- Parent ContentType: Item (0x01) -->
    <!-- set  Inherits="FALSE" so the new template is picked up-->
    <ContentType ID="0x01000a35b7a7e98c46248e063d79ddd67f6c"
                 Name="MarketPlaceContentType"
                 Group=""
                 Description="Market place item, holds Title, Description, Category etc"
                 Inherits="FALSE"
                 Version="0">
        <FieldRefs>
            <FieldRef ID="{060E50AC-E9C1-4D3C-B1F9-DE0BCAC300F6}" Name="Price" DisplayName="Price" Required="TRUE" />
        </FieldRefs>
    </ContentType>
</Elements>

2)我们使用此内容类型

创建了一个列表定义

&LT;

?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" Title="Lists - MarketPlace" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/Lists-MarketPlace"
      BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/" NavigateForFormsPages="False" DisableAttachments="true" BrowserFileHandling="permissive" EnableContentTypes="TRUE">
    <MetaData>
        <ContentTypes>
            <ContentType ID="0x01000a35b7a7e98c46248e063d79ddd67f6c" Name="MarketPlaceContentType"
                         Group="" Description="Market place item, holds Title, Description, Category etc" >
                <FieldRefs>
                            <FieldRef ID="{060E50AC-E9C1-4D3C-B1F9-DE0BCAC300F6}" Name="Price" DisplayName="Price" Required="true" />
                   </FieldRefs>
            </ContentType>
        </ContentTypes>
        <Fields>
            <Field ID="{060e50ac-e9c1-4d3c-b1f9-de0bcac300f6}" Name="Price" DisplayName="Price" Type="Text" Required="True" Group="" />
        </Fields>
        <Views>
            <View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">
                <Toolbar Type="Standard" />
                <XslLink>main.xsl</XslLink>
                <RowLimit Paged="TRUE">30</RowLimit>
                <ViewFields>
                    <FieldRef Name="LinkTitleNoMenu">
                    </FieldRef>
                </ViewFields>
                <Query>
                    <OrderBy>
                        <FieldRef Name="Modified" Ascending="FALSE">
                        </FieldRef>
                    </OrderBy>
                </Query>
                <ParameterBindings>
                    <ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" />
                    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
                    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" />
                </ParameterBindings>
            </View>
            <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE"
                  MobileDefaultView="TRUE"
                  SetupPath="pages\template\marketpgviewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx" >
                <Toolbar Type="Standard" />
                <XslLink Default="TRUE">main.xsl</XslLink>
                <RowLimit Paged="TRUE">10</RowLimit>
                <ViewFields>
                    <FieldRef Name="MarketplaceCategories" DisplayName="Category"></FieldRef>
                    <FieldRef Name="LinkTitle" DisplayName="Title"></FieldRef>
                    <FieldRef Name="Author" DisplayName="Name" />
                    <FieldRef Name="Created" Format="DateOnly"  DisplayName="Date"/>
                    <FieldRef Name="Locations" DisplayName="Location"></FieldRef>
                    <FieldRef Name="MarketplaceItemExpiryDate" DisplayName="Expiry Date" Format="DateOnly"></FieldRef>
                </ViewFields>
                <Query>
                    <OrderBy>
                        <FieldRef Name="ID" Ascending="False" />
                    </OrderBy>
                </Query>
                <ParameterBindings>
                    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
                    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
                </ParameterBindings>
            </View>
            <View BaseViewID="2" Type="HTML" WebPartZoneID="Main" DisplayName="Items By Category" DefaultView="false" MobileView="TRUE"
                  MobileDefaultView="TRUE"
                  SetupPath="pages\template\marketpgviewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="ItemsByCategory.aspx" >
                <Toolbar Type="Standard" />
                <XslLink Default="TRUE">main.xsl</XslLink>
                <RowLimit Paged="TRUE">10</RowLimit>
                <ViewFields>
                    <FieldRef Name="LinkTitle" DisplayName="Title"></FieldRef>
                    <FieldRef Name="Price"/>
                </ViewFields>
                <Query>
                    <Where>
                        <Eq>
                            <FieldRef Name="MarketplaceCategories" />
                            <Value Type="Text">{MarketplaceCategories}</Value>
                        </Eq>
                    </Where>
                    <OrderBy>
                        <FieldRef Name="Created" Ascending="False" />
                    </OrderBy>
                </Query>
                <ParameterBindings>
                    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
                    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
                    <ParameterBinding Name="MarketplaceCategories" Location="Control(tcCategories, SelectedItem)"/>
                </ParameterBindings>
            </View>


        </Views>
        <Forms>
            <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main"/>
            <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
            <Form Type="DisplayForm" Url="CustomDisplayForm.aspx" SetupPath="features\$SharePoint.Feature.DeploymentPath$\MarketPlace\displayitem.aspx" UseLegacyForm="true" WebPartZoneID="Main" Template="MarketPlaceDisplayForm"/>
        </Forms>
    </MetaData>
</List>

3)我们的内容类型包含我们想要修改其属性的各个字段,但我们无法轻松更新它们。

关于我们做错事的任何指示都会很棒!!!!

答案 1 :(得分:1)

我们已经解决了这个问题,因为任何读过这篇文章并花费数小时精神的人就像我一样!!

内容类型允许您创建基本数据结构以供重复使用,例如JumbleSale项目。该项具有SharePoint中已存在的各种属性作为站点列,例如标题。它还具有一些“CUSTOM PROJECT”特有的属性,例如“位置”和一些对于该项目唯一的属性,例如:价。

JumbleSale内容类型定义了将所有这些属性保存在一起的结构。内容类型特有的新字段在内容类型的elements.xml中定义。来自“CUSTOM PROJECT”的重复使用的字段&#39;和SharePoint站点列通过FieldRef属性引用(NB。&#39; CUSTOM PROJECT&#39;站点列可以在Custom&#39; CUSTOM PROJECT&#39; Fields wsp中定义)。

通过schema.xml声明的列表定义引用了这些内容类型定义。他们还列出了视图和过滤器。 (注意:OTB Visual studio会将内容类型定义复制到schema.xml中的内容类型字段ref部分。为避免复杂化,请删除重复的FieldRef。) 要更新列表定义中任何SharePoint站点列的displayName: 通过将字段定义复制到架构中的“字段”部分来重新声明字段。 更新displayName属性 添加Sealed =“TRUE”

更新视图以显示您要显示的内容类型的列。

请查看类似方案的此链接,http://spandothers.wordpress.com/2009/01/17/renaming-the-title-column-in-a-sharepoint-list/