I have created a custom field type based on SPFieldText and realized down the lane that it has a maximum size limit of 255 characters.
So I modified my code to have my field derive from the SPFieldMultiLineText.
But that did not solve the issue - I still got the same error as when I used SPFieldText:
"Invalid text value
A text field contains invalid data. Please check the value and try again."
Thanks to Serge's blog SharePoint: Custom Field Type for MultiLine text, I got over the problem!
Apparently, just have the class derive SPFieldMultilineText is not enough.
The data type of the base field type used must be specified in FieldTypes XML as "Note".
<?xml version="1.0" encoding="utf-8"?>
<FieldTypes>
<FieldType>
<Field Name="TypeName">MyTagType</Field>
<Field Name="ParentType">Note</Field>
<Field Name="TypeDisplayName">MyTagType</Field>
<Field Name="TypeShortDescription">Tags</Field>
<Field Name="UserCreatable">TRUE</Field>
<Field Name="ShowInListCreate">TRUE</Field>
<Field Name="ShowInSurveyCreate">TRUE</Field>
<Field Name="ShowInDocumentLibraryCreate">TRUE</Field>
.
.
</FieldType>
</FieldTypes>
"Ahhh! Another SharePoint Ephiphany."
Thank you, Serge!
No comments:
Post a Comment