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 »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Field validation
Pages: [1]

Author Topic: Field validation  (Read 1332 times)

yamba

  • Guest
Field validation
December 04, 2007, 07:24:36 am
First, I must say that I'm amazed by the Profiles feature. It's so useful to reflect organization needs! It’s an out of the box functionality that makes a true differentiator from the other CRM solutions.

That being said, I have a question regarding what would be the best approach to perform field validation using regular expressions. Let’s say that I want to force the users to enter the information in specific format. Ex: phone numbers with XXX-XXX-XXXX format.

In the documentation, I’ve read the part on the custom fields and I did not see mention of validation. There was also a part on the hook specification, but It wasn’t clear to me where and how to use it.

From what I understood, the way I would do it is to use the profiles and then add validation code to the code generated by CiviCRM.  But before doing this, I wanted to verify it there was an easiest way to perform field validation or if it was planned to add built-in functionalities for this purpose in the next releases of CiviCRM (if it's the case, I would be glad to contribute).

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Field validation
December 04, 2007, 10:21:31 am
We will be working on a project at this week's "BootCamp" which will allow folks to add client-side (JavaScript) and server-side (PHP) field and form validation for custom data fields. Depending on progress - this functionality would appear in either 2.0 or 2.1. We'll post an update on the Blog after the session.
Protect your investment in CiviCRM by  becoming a Member!

yamba

  • Guest
Re: Field validation
December 04, 2007, 06:14:16 pm
Thanks.  In the mean time, is using custom validation javascripts with the profile forms is the simpler approach?

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Field validation
December 04, 2007, 10:45:40 pm
I haven't tried this - but you might be able to accomplish what you need by injecting javascript function(s) into a custom copy of the profile template.

http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in+and+Profile+Screens

... or using a standalone copy of a profile form (which would be easier to add jscript to since you can add an onsubmit function into the form tag and add jscript statements to particular field elements).
Protect your investment in CiviCRM by  becoming a Member!

yamba

  • Guest
Re: Field validation
December 09, 2007, 02:28:42 am
Yes, I will choose the stand alone form for now. It's the most efficient manner.  Many Thanks for the guidance!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Field validation

This forum was archived on 2017-11-26.