Had an error on a Rich Text box in that it did not show a validation error when text was entered then removed.
I had various form validations: not blank, regular expression, expression string-length---did work.
Since I was using managed code anyway--I put code in error routine that still didn't work
try
{
string strFullMessage = xn.SelectSingleNode("/my:myFields/my:InitializedVariables/my:FullMessage", NamespaceManager).Value;
if (strFullMessage.Length == 0)
{
_errorString += "FullMessage" + ": " + "must contain a value";
if (errcnt == 0)
{
txtErrmsg_01.SetValue("FullMessage" + ": " + "must contain a value");
}
else
{
txtErrmsg_02.SetValue("FullMessage" + ": " + "must contain a value");
}
errcnt++;
}
}
catch (Exception ex)
{
if (errcnt == 0)
{
txtErrmsg_01.SetValue("FullMessage" + ": " + ex.Message.ToString());
}
else
{
txtErrmsg_02.SetValue("FullMessage" + ": " + ex.Message.ToString());
}
}
Finally I decided to display the string length on the form at various states in an optional debug session I use: string-length(Full-Message)
Turns out that once data is put into the Rich-Textbox and subsequently removed it has a length of 1 NOT 0.
I changed the above code to if (strFullMessage ==1) and I began to detect a blank Rich Text box.