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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Adding a hook to automatically format fields
Pages: [1]

Author Topic: Adding a hook to automatically format fields  (Read 1624 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Adding a hook to automatically format fields
February 13, 2009, 01:03:46 am
Hi,

I'd like to autoformat, both on the main individual form, on profiles and on import.

For instance, force the last names to always be in uppercase, the first letter of the first name to be in upper, the rest lowercase, the phone number to start with a +, the name of an organisation always to be in lowercase...

Is there already a hook for that ?

shouldn't it be added to the core (possibly as a param to toggle in and out ) ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Adding a hook to automatically format fields
February 13, 2009, 02:01:00 pm
This is something we have also needed - and preferably for Title Case for any text strings longer than 1 character in Address fields too, though no doubt someone will have an example where this won't apply
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Adding a hook to automatically format fields
February 13, 2009, 03:28:10 pm

you should be able to modify the names etc by implementing the civicrm_pre hook for contact object and modifying the params

we currently dont have hooks for phone / email etc, but can consider adding them

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Adding a hook to automatically format fields

This forum was archived on 2017-11-26.