Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SharePoint field not showing in Display/Edit/New pages

I've written a schema for a list that only needs to add one column to the default custom list which is a number field called months. The field is shown on the default view and is indeed created on the list. The list is autopopulated with values which get set properly. The problem is that the field doesn't appear on the display/edit/new pages. It can be set through the datasheet view. I don't understand why it isn't showing up when I specifically set it to in the schema.

Would very much appriciate any suggestions.

<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" 
      Title="ReviewPeriods" 
      FolderCreation="FALSE" 
      Direction="$Resources:Direction;" 
      Url="Lists/ReviewPeriods" 
      EnableContentTypes="TRUE" 
      BaseType="0">
 <MetaData>
  <ContentTypes>
   <ContentTypeRef ID="0x01">
        <Folder TargetName="Item" />
      </ContentTypeRef>
  </ContentTypes>
  <Fields>
   <Field ID="{B99EB797-4057-4a75-90BF-B40D0F89A9D9}"
             Type="Number"
             Decimals="0"
             Min="0"
             Max="100"
             Percentage="FALSE"
             Name="Months" 
             Required="TRUE"
             Group="SEED"
             DisplayName="Months"
             StaticName="Months"
             ShowInDisplayForm="TRUE"
             ShowInEditForm="TRUE"
             ShowInNewForm="TRUE">
   </Field>
  </Fields>
  <Views>   
   <View BaseViewID="0" 
            Type="HTML"
            WebPartZoneID="Main" 
            DisplayName="Default View" 
            DefaultView="TRUE" 
            SetupPath="pages\viewpage.aspx" 
            ImageUrl="/_layouts/images/generic.png" 
            Url="AllItems.aspx">

... Hidden Stuff ...

<ViewFields>
          <FieldRef Name="LinkTitle"></FieldRef>
          <FieldRef Name="Months"></FieldRef>
    </ViewFields>
    <Query>
     <OrderBy>
      <FieldRef Name="Title">
      </FieldRef>
     </OrderBy>
    </Query>
   </View>
  </Views>
  <Forms>
   <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
   <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
   <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
  </Forms>
 </MetaData>
</List>
like image 315
Daniel Revell Avatar asked Jan 30 '26 03:01

Daniel Revell


1 Answers

The problem is that you add the field to the list, but at the same time enable content types and specify that the only content type to use is Item (0x01) which doesn't include the field. So you're adding/editing Items and then you don't get the field.

There are two solutions:

  1. Don't enable content types (and then also remove the whole <ContentTypes> section)
  2. Create a new content type including the field and add that content type instead of Item
like image 127
Per Jakobsen Avatar answered Jan 31 '26 17:01

Per Jakobsen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!