Subscribe:      
 

Regular Expressions OH MY!

Written By: Rebecca Jones -- 5/12/2011 -- join -- contribute -- (9) comments -- printer friendly version

Rating: Rate --

Categories: Design, MOSS 2007, SharePoint Designer 2007, WSS3

< Prev - 1 | 2 | 3 | 4 | - Next > | Become a paid author

Problem

Are you tired of users not putting the correct information in on your forms? Recently I have come across issues where users were putting letters instead of numbers for a phone number field or not putting dashes in for their SSN. The question is how do you stop this from happening?

Remember back in the day when you wanted to validate form fields in ASP, what did you use? Well you used Regular Expressions or RegExpr. Remember SharePoint is built on ASP technology so why shouldn't you be able to use regExpr in SharePoint?

The answer is you can.

This tip will show you how to integrate regular expressions on your forms to validate such inputs as SSN, phone numbers, and email addresses. Sit back and relax and let's begin. Note- SharePoint Designer is needed to replicate this tip. It can be downloaded for free by clicking on the link SharePoint Designer.

Solution

1. Open up your site in SharePoint Designer.

2. Browse to your custom list. The list this tip is referencing is called RegExpression.

Note make a copy of the NewForm.aspx and the EditForm.aspx. That way if you make a mistake you still have the original form.

Notice in the screenshot below my copied pages are in the same folder as the original one. I rename my NewForm_copy(1).aspx to custom_new.aspx


3. Open up the new copy (Custom_new.aspx).

pic2

4. Right click on the Web part and select Web Part Properties.

pic3

< Prev - 1 | 2 | 3 | 4 | - Next >



Learn more about SharePoint



Sponsor Information




Copyright (c) 2010-2017 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | contribute | feedback | about
Some names and products listed are the registered trademarks of their respective owners.


MSSharePointTips.com | MSSQLTips.com