Hi Joe, I ran into a bit of a mess when I was adding some regular expression validations to a form. On one of the fields, I had a typo in the regular expression, and that resulted in a crash when I went to the form page. Of course, at that point there was no way to recover other than a SQL whack to remove the offending regex entries from the database. Here is the error I got in the server log:
2010-08-19 15:24:24,420 ERROR mojoPortal.Web.Global - {IP Address}-en-US - /alarm-registration-application.aspx
System.Web.HttpException (0x80004005): ^(\^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$ is not a valid regular expression. ---> System.ArgumentException: parsing "^(\^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$" - Not enough )'s.
at System.Text.RegularExpressions.RegexParser.ScanRegex()
at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)
at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, Boolean useCache)
at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern)
at System.Web.UI.WebControls.RegularExpressionValidator.set_ValidationExpression(String value)
at System.Web.UI.WebControls.RegularExpressionValidator.set_ValidationExpression(String value)
at sts.FormWizard.Web.UI.TextBoxQuestion.SetupControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
2010-08-19 15:24:34,310 ERROR mojoPortal.Web.mojoBasePage - {IP Address}-en-US - /alarm-registration-application.aspx
Just in case anyone else has this problem or is interested, here is the SQL I used to update the database to work around this:
update sts_webformquestion set ValidationExpression = '' where InvalidMessage = 'Phone must be 7 or 10 digits, with dashes';
After that, I went back to the form editor and put in corrected regular expressions for each of the phone prompts in the form.
So, as a fix, can you either prevalidate the regular expressions upon entry, or at least trap the error during form display so it doesn't cause a crash?
Thanks,
Jamie