Invalid regex handling in FWP

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
8/19/2010 5:43:45 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Invalid regex handling in FWP

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

8/20/2010 9:31:18 AM
Gravatar
Total Posts 18439

Re: Invalid regex handling in FWP

Hi Jamie,

Thanks for the bug report. I am able to produce this problem and will fix it for the next release of Form Wizard.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.