We had similar kind of issue with "notes" filed (description) in a blogs site. Here is what I noticed, When the form is being saved, The notes is trimming certain tags before saving the content. We have this issue when we tried to add "object" tags. This could be because of security limitations that MS implemented for SQL end.
We extended the "SPFieldMultiLineText", "BaseFieldControl" classes to encode the field value before saving the content by the base class.
public class ExtField : SPFieldMultiLineText //SPFieldText
{
public ExtField(SPFieldCollection fields, string fieldName)
: base(fields, fieldName)
{ }
public ExtField(SPFieldCollection fields, string typeName, string displayName)
: base(fields, typeName, displayName)
{ }
public override string GetValidatedString(object value)
{
return value.ToString();
}
public override BaseFieldControl FieldRenderingControl
{
get
{
BaseFieldControl fieldControl = new ExtFieldControl();
fieldControl.FieldName = this.InternalName;
return fieldControl;
}
}
}
[SharePointPermission(SecurityAction.InheritanceDemand, ObjectModel = true), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true), AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class ExtFieldControl : BaseFieldControl //RichTextField
{
protected editor Editor;
// Methods
public ExtFieldControl()
{
}
protected override string DefaultTemplateName
{
get { return "ExtTextField"; }
}
/// <summary>
/// Encode and decode the value in order to avoid the replacement of text by sharepoint framework (like <embeed></embeed> tags)
/// </summary>
public override object Value
{
get
{
EnsureChildControls();
return SPHttpUtility.HtmlEncode(RemoveEmptyDiv(Editor.Value));
}
set
{
try
{
EnsureChildControls();
Editor.Value = SPHttpUtility.HtmlDecode(value.ToString());
}
catch { }
}
}
public override void Focus()
{
EnsureChildControls();
Editor.Focus();
}
protected override void CreateChildControls()
{
try
{
if (Field == null) return;
base.CreateChildControls();
//Don't render the textbox if we are just displaying the field
if (ControlMode == Microsoft.SharePoint.WebControls.SPControlMode.Display) return;
Editor = (editor)TemplateContainer.FindControl("TextField");
if (FckEditor == null) throw new NullReferenceException("TextField(Body) is null");
//Editor.BasePath = GetBasePath(); user "_layouts" folder. This property is configured witin the rendering template itself
if (ControlMode == Microsoft.SharePoint.WebControls.SPControlMode.New)
Editor.Value = "";
}
catch(Exception ex)
{}
}
}
}
Basically we created a new field and deployed it as a feature then used this extended field instead of inbuilt "Notes" field.
this "http://www.sharethispoint.com/archive/2006/08/07/23.aspx" help you how to create a custom field type
Hope this should help you.