The Spotlight
The Official Blog for Arts and Cultural Organizations

Validate form fields in Patron Edge Online

Patron Edge Online can be a double-edged sword when it comes to data entry. A user has the ability to enter his own address and phone information so that you don't have to try to track it down elsewhere later on, but when you don't enforce any kind of formatting standard, searching or reporting on it in the system can become a pain. Luckily PEO has a built-in feature that allows you to validate form fields using something called a regular expression. If that phrase means nothing to you, don't worry. We have a regular expression builder that will walk you through it. If you are familiar with JavaScript regular expressions, you can write them manually and bypass the builder tool.

Regular expressions are a great way to test for valid phone and email formatting, so be sure to take a few minutes this week and set up a few. To illustrate how to use the builder, here is an example that forces Email to have an @ symbol and at least one period.
  1. Go to Administration, System Setup, User-Fields Rules
  2. Edit the row for Email
  3. Click the regular expression builder button beside Regular Exp 1
  4. From the Begins with drop-down list, select 'any char' that occurs 'once or many'
  5. In the Followed By section, select 'the char', enter the @ symbol, and select occurs 'once'. Then click Add
  6. Change Followed By to 'any char' that occurs 'once or many' and click Add
  7. Change Followed By again to 'the char', enter a period and select occurs 'once'. Click Add again
  8. In the Ends With section, select 'any char' occurs 'once or many'
  9. To test, enter various combinations of values in the Validate field and click Validate. An alert box will tell if the values pass the rule or not.
  10. When finished, click OK.

If you are familiar with creating regular expressions, you can type directly into the Regular Exp 1 field and skip the builder. In the above example, you can type the expression ^.+@.+\..+$ directly into the field. Advanced users note: the regular expression field does not support the Replace or Split methods, only the Test method.

What other regular expressions are you using to keep your data in a nice, clean format? Leave a note in the comments.


Comments

John Holm said:

thanks for this post nicholai!  i have my site monkey proof now.  hare are some regex's that others may find useful:

email:

^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$

credit cards:

^[3456][0-9]{12,15}$

matches amex,visa,discover,MC

Cvv2:

^[0-9]{3,4}$

Phone Numbers:

^[0-9 .\-+()xcwhXCWH]{10,30}$

Delivery US Zip Code:

^[0-9- ]{5,10}$

The way it displays on the front end on peo is a message popup. It uses the same alert box as the 'Missing fields' errors.  If a field is not required, it will not validate it if it is empty.

_J

# August 4, 2008 2:51 PM

Shannon said:

One of our biggest problems is entering cities in the city field that are not in our data base... For example, when patrons use their own abbreviations for a city...

Having them just type in a zip code and auto filling the city or something similar one day would be REALLY nice :)

# August 14, 2008 3:06 PM

Norma Croda said:

Shannon - that is exactly the problem we are having and I came here looking for a solution.  We spend so much time cleaning up records because people do not spell out (correctly) the city names.  We then have to clean up our address city table in configuration.

And, how many people use lower case to fill out their information!!! which, of course, we have to correct.

I would like to hear from others with these problems and if you were able to solve them.

# August 21, 2008 10:31 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: