CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Regular Expression Match on Form Input Fields
Pages: [1]

Author Topic: Regular Expression Match on Form Input Fields  (Read 1063 times)

rs3515

  • I’m new here
  • *
  • Posts: 29
  • Karma: 1
Regular Expression Match on Form Input Fields
May 06, 2008, 08:00:09 am
If, for example, a user is making a contribution, is there a way to easily apply preg_match to fields like postal code and phone number, and return error messages?  Contributions will only be from US addresses, so postal codes will be limited to ZIP and ZIP+4, and phone numbers will be limited to 10 digits plus various separators.

Improper ZIP codes can lead to a fair amount of failed transaction requests.  I'd rather catch these problems prior to sending it to the credit card processor.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Regular Expression Match on Form Input Fields
May 08, 2008, 02:48:14 am
If you're ok about having the validation be "server-side" (i.e. not Javascript client side error trapping) - then you might be able to use the validation hook described here:

http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Regular Expression Match on Form Input Fields

This forum was archived on 2017-11-26.