1

I have the following content type definition and list definition, the description field should show me 4 lines, maxlength 255, but it always shows me One line one.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Parent ContentType: Link (0x0105) -->
  <ContentType ID="0x01050095b7aa21bdb44df09b7f4ce6acbc17cf"
               Name="OST.HWT - CTMirageTeamsCIRCALinks"
               Group="Custom Content Types"
               Description="CTMirageTeamsCIRCALinks"
               Inherits="TRUE"
               Version="0">
    <FieldRefs>
      <FieldRef ID="{A6A5709D-6F9A-49CE-B623-C1159251C50B}"
        Name="ExternalSiteDescription"
        DisplayName="Description"
        Required="False" NumLines="4"/>
      <RemoveFieldRef ID="{9da97a8a-1da5-4a77-98d3-4bc10456e700}" Name="Comments"  />


    </FieldRefs>

  </ContentType>
</Elements>



<List xmlns:ows="Microsoft SharePoint" Title="OST.HWT - CIRCALinks" Direction="$Resources:core,Direction;" OrderedList="TRUE" Url="Lists/OST.HWT-CIRCALinks" BaseType="0" DisableAttachments="TRUE" xmlns="http://schemas.microsoft.com/sharepoint/">
  <MetaData>
    <ContentTypes>
      <ContentType ID="0x01050095b7aa21bdb44df09b7f4ce6acbc17cf" Name="OST.HWT - CTMirageTeamsCIRCALinks" Group="Custom Content Types" Description="CTMirageTeamsCIRCALinks" Inherits="TRUE" Version="0">
        <FieldRefs>
          <FieldRef ID="{A6A5709D-6F9A-49CE-B623-C1159251C50B}" Name="ExternalSiteDescription" DisplayName="Description" Required="False" />
        </FieldRefs>
      </ContentType>
    </ContentTypes>
    <Fields>
      <Field ID="{82642ec8-ef9b-478f-acf9-31f7d45fbc31}" Name="LinkTitle" Hidden="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="LinkTitle">
      </Field>
      <Field ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" Name="LinkTitleNoMenu" Hidden="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="LinkTitleNoMenu">
      </Field>
      <Field ID="{081c6e4c-5c14-4f20-b23e-1a71ceb6a67c}" Name="DocIcon" DisplaceOnUpgrade="TRUE" DisplayName="$Resources:core,Type;" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="DocIcon">
      </Field>      
      <Field ID="{c29e077d-f466-4d8e-8bbe-72b66c5f205c}" Type="URL" Name="URL" DisplayName="$Resources:core,URL;" Required="TRUE" FromBaseType="TRUE" ShowInViewForms="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="URL">
      </Field>
      <Field ID="{9da97a8a-1da5-4a77-98d3-4bc10456e700}" Type="Note" Hidden="TRUE" Name="Comments" DisplayName="$Resources:core,Notes;" Sortable="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Comments">
      </Field>
      <Field ID="{2a9ab6d3-268a-4c1c-9897-e5f018f87e64}" ReadOnly="TRUE" Filterable="FALSE" Type="Computed" Name="URLwMenu" DisplayName="$Resources:core,URL;" DisplayNameSrcField="URL" ClassInfo="Menu" AuthoringInfo="$Resources:core,URLwEditMenu;" ListItemMenuAllowed="Required" LinkToItemAllowed="Prohibited" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="URLwMenu">
        <FieldRefs>
          <FieldRef Name="URL" />
          <FieldRef Name="FileLeafRef" />
          <FieldRef Name="FileRef" />
          <FieldRef Name="FSObjType" />
          <FieldRef Name="_EditMenuTableStart2" />
          <FieldRef Name="_EditMenuTableEnd" />
        </FieldRefs>
      </Field>
      <Field ID="{7A7F3660-D408-4734-9AA0-2D86E33D79AB}" ReadOnly="TRUE" Filterable="FALSE" Type="Computed" Name="URLwMenu2" DisplayName="$Resources:core,URL;" DisplayNameSrcField="URL" ClassInfo="Menu" AuthoringInfo="$Resources:core,URLwEditMenu; (old)" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="URLwMenu2">
        <FieldRefs>
          <FieldRef Name="URL" />
          <FieldRef Name="FileLeafRef" />
          <FieldRef Name="FileRef" />
          <FieldRef Name="FSObjType" />
          <FieldRef Name="_EditMenuTableStart" />
          <FieldRef Name="_EditMenuTableEnd" />
        </FieldRefs>
      </Field>
      <Field ID="{aeaf07ee-d2fb-448b-a7a3-cf7e062d6c2a}" DisplaceOnUpgrade="TRUE" ReadOnly="TRUE" Filterable="FALSE" Type="Computed" Name="URLNoMenu" DisplayName="$Resources:core,URL;" DisplayNameSrcField="URL" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="URLNoMenu">
        <FieldRefs>
          <FieldRef Name="URL" />
          <FieldRef Name="FileLeafRef" />
          <FieldRef Name="FileRef" />
          <FieldRef Name="FSObjType" />
        </FieldRefs>
      </Field>
      <Field ID="{a6a5709d-6f9a-49ce-b623-c1159251c50b}" Name="ExternalSiteDescription" Type="Text" DisplayName="Description" Required="FALSE" Group="Mirage Teams Columns" NumLines="4" />
      <Field ID="{503f1caa-358e-4918-9094-4a2cdc4bc034}" Name="Edit" DisplayName="$Resources:core,Edit;" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Edit">
      </Field>
    </Fields>
6

In the list definition the ExternalSiteDescription field is defined as Text. Text fields are single lines with a configurable max length (via MaxLength).

To create a multiline field you must use the Note field type. With the Note type you can set the number of lines with NumLines. You can probably use MaxLength on Note field too. (i'm not completely sure, untested!)

See MSDN for field types available in the <Field> element.

1

Unfortunately you can't use the MaxLength property with a Notes field, it's not supported, see here

Multiline fields are rendered as <textarea>'s and this HTML control doesn't support a maxlength property like an <input> field does.

  • +! - saved me a lot of hassle. – JᴀʏMᴇᴇ Feb 8 '13 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.