Posted by Adam Buenz
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:
C#:
-
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();
-
}
-
-
}











October 13th, 2007 at 4:57 pm
[...] 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 [...]
October 25th, 2007 at 5:27 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. … [...]