Custom Field Validation With SPFieldValidationException
There was a post in the newsgroups wondering how when constructing a custom field type how one might build a small generic validation function in order to verify the harvested user input. There is provided the SPField.GetValidatedString method, which is overridable, that can be used in order to achieve this since it will take the object input provided by the custom field type and provide a workable string representation.
An example of this method is this:
-
private readonly string m_strValidationException = "Hmmm, your string length wasen't 10!";
-
-
public override string GetValidatedString(object oValue)
-
{
-
if (oValue.ToString().Length != 10)
-
-
{
-
}
-
-
else
-
-
{
-
return oValue.ToString();
-
}
-
-
}
2 Comments »
RSS feed for comments on this post. TrackBack URL





















Articles & Research
SharePoint Architecture
Personal/Off-Topic
Latest Free SharePoint Software
SecureCenter For SharePoint
SharePoint Security Assurance Program™
Free Online SharePoint Security Tools
Online SharePoint Security Health Assessment
Article Or Research Filed Under 
[...] There was a post in the newsgroups wondering how when constructing a custom field type how one might build a small generic validation function in order to verify the harvested user input. There is provided the SPField.GetValidatedString method, which Read More……(read more) October 13th 2007 Posted to Uncategorized [...]
Pingback by Blogger Loser » Custom Field Validation With SPFieldValidationException — October 13, 2007 @ 4:57 pm
[...] desconocido wrote an interesting post today!.Here’s a quick excerptThere was a post in the newsgroups wondering how when constructing a custom field type how one might build a small generic validation function in order to verify the harvested user input. There is provided the SPField. … [...]
Pingback by ThemePassion - Best stuff about design! » Custom Field Validation With SPFieldValidationException — October 25, 2007 @ 5:27 pm