Video Screencast Help

Custom Form Validation in Workflow Solution

Created: 29 Jun 2009 • Updated: 09 Sep 2010 | 7 comments
ChrisBern's picture
+3 3 Votes
Login to vote

In this 10-minute video, I will demonstrate a few simple examples of custom form validation in a web forms project. Specifically, I create a simple web form in Workflow Solution which asks for an email address and a start/end date range. Then, I add custom validation to the web form to ensure that the user has entered an email address that matches standard email address format (x@y.com). Finally, I also add custom validation to ensure that the start date precedes the end date, and then I demonstrate the validation errors which occur when the data is improperly entered on the form.

Keywords: Form builder, textbox, datepicker, use custom validation, button, required field, model, regex, find common pattern, string, process variable, error message, date greater than rule

Video Upload: 

Comments 7 CommentsJump to latest comment

lone_ranger's picture

Good video Chris. Keep up the good work.

+1
Login to vote
DannyTW's picture

Very nice.
With your help, Chris, I built a similar validation in a form, but since I am use the Date/Time picker (instead of just the Date picker), I don't have the option of customizing validation inside of the component. To accomplish my validation, I have done the following:

  1. Create a box somewhere in your form
  2. Doubleclick on the box you just created
  3. Click on the Functionality tab
  4. In the Output Paths: field, find the button that you want to use to trigger the validation, then put the black dot in the circle next to Optional for that button
  5. Set the Visible: field to "False"
  6. Check the Use Custom Validation: box, then follow Chris's instructionsfor creating the Custom Validation Model
+1
Login to vote
haryadoon's picture

Does anyone know the EXACT logic (regular expression) behind the "Internet e-mail address" validation ?   All the comments and examples that reference this validation use x@y.com as the "valid format".  This isn't correct ... there really are TLDs other than dot.com !   What about x@y.net, x@y.us, x@y.co.uk, and so on throughout the world ?  All valid addresses.

+1
Login to vote
yliquor's picture

I would like to know that as well!

+1
Login to vote
ChrisBern's picture

My description above was too simple when I mentioned x@y.com.  With a little reverse engineering, it appears that the Find Common Pattern component is filtering against this expression:

 

x@y.z

 

Where x, y and z can be any string.  z can be a string with a dot in it as well, for example co.uk.  I tested with your examples and they all worked, but any variation from x@y.z did not work (for example x@y).

 

If you want to make sure that someone puts in a TRULY valid email address, i.e. one that actually exists instead of just matching a pattern, there are web services that you can call (via the Web Service Caller Generator) to validate an email address.  I'm not sure if there are any free ones, though...there may be a subscription fee for such a service.

 

Good luck.

0
Login to vote
haryadoon's picture

Good response, Chris. I discovered this article on the subject... It can be quite complex.
http://www.regular-expressions.info/email.html

0
Login to vote
ChrisBern's picture

And you're right, it's getting more and more complex each year with the addition of new top-level domains. 

 

Also I haven't worked with it in some time, but I believe you can use the FindMultipleMatchesComponent to put in your own Regex expression(s), if you want to have more control over the exact validation.  Last I checked this component did a good job of telling you whether there was a match or not, and what the index (first position) of the match was, but it didn't give you a length or an easy way to get the actual "matched object" into its own variable.  But for the purpose of validating a field to determine whether there is a match or not, this component should give you more flexibility to do that if the built-in expressions aren't perfect for your needs.

0
Login to vote