Skip to main content

GROWING AND SUSTAINING RELATIONSHIPS

GROWING AND SUSTAINING RELATIONSHIPS
Close
Michal Mach

Core Team Member, Developer, Implementor

CiviCRM, Caltha

http://civicrm.org

I've always been passionate about what non-profits and advocacy groups can achieve using technology. For me, CiviCRM shows an essential example of how non-profit and technology worlds can come together to provide real change - working as community, creating value for yourself, but also for others in non-profit sector.

GROWING AND SUSTAINING RELATIONSHIPS
Close
David Moreton

Consultant, Implementor and End-user

Circle Interactive

http://www.civisites.com

We help many not for profits implement CiviCRM through consultancy, training, configuration and custom development. Many of them come from a painful world of old Access databases, multiple spreadsheets and even paper. It's really satisfying to
help people move on with a system that's so much in tune with their own ethics of sharing and collaboration. We also 'eat our own dog food' and use Civi in-house for our client records because we love the flexibility and control it gives us.

For us it's important to share code and advice with other members of the community when we can because we know we get it back in help at other times. The community really is awesome and one of the friendliest and undaunting I've come across. We appreciate the huge value of the software to us and our clients so we try to contribute back and make it even better.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Andrew Hunt

Implementor, Developer

AGH Strategies

http://aghstrategies.com

CiviCRM allows our clients to have a robust tool for tracking and engaging their supporters that can grow with them. I began as an end user, and now I work with CiviCRM full-time.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Joshua Lange

Administrator

Concordia Welfare & Education Foundation

http://cwef.org.hk

CWEF is deploying CiviCRM on Wordpress to build and manage a database of our staff, volunteer, recipient, donor and partner contacts.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Lynna Landstreet

Web developer

Freeform Solutions

http://www.freeform.ca

Freeform Solutions uses CiviCRM to help the non-profit organizations we develop sites for to manage information about their members, volunteers, activists, donors, employees and other contacts, and to handle donations, correspondence, mailings and more. We support the CiviCRM community by contributing documentation, patches, modules and code, and are a silver sponsor of CiviCon 2013.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Kendall Dinwiddie

Developer

Democratic Volunteer Center

http://www.demvolctr.org

Gathering volunteer information; assisting delegating group assignments; internal communication

GROWING AND SUSTAINING RELATIONSHIPS
Close
Tim Otten

DEVELOPER AND IMPLEMENTER

CiviCRM

http://civicrm.org

It gives me lots of fun programming to do.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Luciano Spiegel

Developer & Implementator

IXIAM

http://www.ixiam.com

It's all about community. I love the CiviCRM philosophy and in IXIAM, we are trying to expand the spanish speaking community in Spain and Argentina

GROWING AND SUSTAINING RELATIONSHIPS
Close
Kellie Brownell

End-user

EFF

https://www.eff.org

The CiviCRM community has been a tremendous resource for new ideas and helping us solve problems. We are excited to contribute customizations EFF makes back to core and support new features such as batch entry for offline donations or multiple payment processors on one donation form.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Jon Goldberg

Implementor

Palante Technology Cooperative

http://palantetech.com

Palante Tech works with social justice organizations on a tight budget to be more effective through technology. CiviCRM allows us to provide a high-quality low-cost database for community organizing, donor and membership management.

GROWING AND SUSTAINING RELATIONSHIPS
Close
Jessica Kirsner

end-user, administrator, implementor

Secular Student Alliance

https://www.secularstudents.org

I am trying to build a stronger End-user community withing CiviCRM to increase cooperation among non-profits using CiviCRM in similar ways. Going to CiviCRON and being a part of the community at the conference has made me want to make the End-user community more robust. I think the open-source and non-profit focused nature of CiviCRM lends itself to strong community building as is an aspect of CiviCRM that is exciting!

GROWING AND SUSTAINING RELATIONSHIPS
Close
DAVE SCHAFER

Implmentor, Developer

Backoffice Thinking

http://www.backofficethinking.com

CiviCRM has allowed us to empower many non-profits to improve their services and become more efficient.

LOGIN | REGISTER
  • Create new account
  • Request new password

Search form

  • BLOG
  • DEMO
  • Find An Expert
  • NEED HELP
  • SUPPORT US
  • DEVELOPER RESOURCES
CiviCRM Community Site logo CiviCRM Community Site
  • WHAT IS CIVICRM
    • Community
    • Case Studies
    • Experts
    • Contributors
    • Core Team
    • Licensing
    • Contact Us
  • WILL CIVICRM MEET YOUR NEEDS?
    • Contacts
    • Contributions
    • Communications
    • Peer-To-Peer Fundraisers
    • Advocacy Campaigns
    • Events
    • Members
    • Reports
    • Case Management
  • GET STARTED
    • Evaluate Your CRM Needs
    • Evaluate CiviCRM Features
    • Read Books
    • Contact an Ambassador
    • Demo CiviCRM
    • Download CiviCRM
    • Download Extensions
    • Find An Expert
  • PARTICIPATE
    • Join the community
    • Make it happen
    • Support CiviCRM
    • Meet ups
    • Document CiviCRM
    • Translate CiviCRM
    • Developer resources

You are here

Home » Blogs » kurund's blog

Blog

  • API
  • Architecture Series
  • CiviCampaign
  • CiviCase
  • CiviCon
  • CiviContribute
  • CiviCRM
  • CiviCRM v4.1
  • CiviEvent
  • CiviMail
  • CiviMember
  • CiviMobile
  • CiviPledge
  • CiviReport
  • Documentation
  • Drupal
  • Extensions
  • Finance and Accounting
  • Interface Design and Layout Standards
  • Internationalization and Localization
  • Joomla
  • Make it happen
  • Marketing and Promotion
  • Meetups
  • Older Versions
  • Release
  • Schools
  • Solutions (case studies and user stories)
  • Sprints
  • Teams
  • Training
  • v1.6
  • v1.7
  • v1.8
  • v1.9
  • v2.0
  • v2.1
  • v2.2
  • v2.3
  • v3.0
  • v3.1
  • v3.2
  • v3.3
  • v3.4 and v4.0
  • v4.2
  • v4.3
  • WordPress

How to implement client side phone validation

Submitted by kurund on November 13, 2011 - 07:40

Recently on CiviCRM irc and forum few people asked about adding client side validation for phone field. By default CiviCRM packages validate plugin, so this can be easily implemented with minor customization. Below is the example of validating US phone number on new contact form.

 

Index: templates/CRM/Contact/Form/Edit/Phone.tpl
===================================================================
--- templates/CRM/Contact/Form/Edit/Phone.tpl   (revision 37399)
+++ templates/CRM/Contact/Form/Edit/Phone.tpl   (working copy)
@@ -39,10 +39,10 @@
     </tr>
 {/if}
 <tr id="Phone_Block_{$blockId}">
-    <td>{$form.phone.$blockId.phone.html}&nbsp;&nbsp;{ts}ext.{/ts}&nbsp;{$form.phone.$blockId.phone_ext.html|crmReplace:class:four}&nbsp;&nbsp;&nbsp;{$form.phone.$blockId.location_type_id.html}</td>
+    <td>{$form.phone.$blockId.phone.html|crmReplace:class:"phoneUS"}&nbsp;&nbsp;{ts}ext.{/ts}&nbsp;{$form.phone.$blockId.phone_ext.html|crmReplace:class:four}&nbsp;&nbsp;&nbsp;{$form.phone.$blockId.location_type_id.html}</td>
     <td colspan="2">{$form.phone.$blockId.phone_type_id.html}</td>
     <td align="center" id="Phone-Primary-html" {if $blockId eq 1}class="hiddenElement"{/if}>{$form.phone.$blockId.is_primary.1.html}</td>
     {if $blockId gt 1}
        <td><a href="#" title="{ts}Delete Phone Block{/ts}" onClick="removeBlock('Phone','{$blockId}'); return false;">{ts}delete{/ts}</a></td>
     {/if}
-</tr>
\ No newline at end of file
+</tr>
Index: packages/jquery/plugins/jquery.civicrm-validate.js
===================================================================
--- packages/jquery/plugins/jquery.civicrm-validate.js  (revision 37399)
+++ packages/jquery/plugins/jquery.civicrm-validate.js  (working copy)
@@ -5,4 +5,13 @@
  *  To define phone validation for your site:
  *  jQuery.validator.addMethod("crm_phone", function(phone_number, element) { validation logic here }
  */
-
+(function() {
+        jQuery.validator.addMethod("phoneUS", function(phone_number, element) {
+            phone_number = phone_number.replace(/\s+/g, ""); 
+            return this.optional(element) || phone_number.length > 9 &&
+                phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
+        }, "Please specify a valid phone number");
+        jQuery.validator.addMethod("postalcode", function(postalcode, element) {
+                return this.optional(element) || postalcode.match(/(^\d{5}(-\d{4})?$)|(^[ABCEGHJKLMNPRSTVXYabceghjklmnpstvxy]{1}\d{1}[A-Za-z]{1} ?\d{1}[A-Za-z]{1}\d{1})$/);
+        }, "Please specify a valid 5 digit zip code.");
+})();
 

I have tested this on CiviCRM v3.4 ( latest ). I hope this is helpful.

 

 

 

  • kurund's blog
  • Log in or register to post comments

Comments

What about normalization?

Permalink Submitted by colemanw on November 13, 2011 - 10:09

Having phone numbers in any random format makes deduping on phone fields difficult. I would love to see phone fields be more strict about what characters they allow (only numbers and dashes) and in what combinations (can't have two dashes in a row). This could happen on the client side for convenience, but would need to happen on the server side as well.

I haven't been able to implement this on my own site because hook_civicrm_pre and hook_civicrm_post don't get fired for phone objects. But I have heard some murmurs on the irc that others may be at work on this problem. Any news?

  • Log in or register to post comments

Hi Coleman - adding PRE &

Permalink Submitted by Eileen on November 13, 2011 - 18:17

Hi Coleman - adding PRE & POST hooks where they are missing is pretty straight forward (and safe). I expect that even though we are in feature freeze Lobo would be OK with putting these into Phone create / add as appropriate

  • Log in or register to post comments

Cool

Permalink Submitted by colemanw on November 15, 2011 - 18:01

I was actually refering to hearing murmurs that others were at work on the phone normalization problem. Any word on that front?

And thanks for the tip about the hooks.

  • Log in or register to post comments

hmm, maybe validate phone numbers at front-end and use

Permalink Submitted by lobo on November 15, 2011 - 20:02

 

mysql triggers to format the numbers before storing them in the backend. Seems to be a lot more efficient than doing them in php and something that triggers is built for :)

  • Log in or register to post comments

CIVICRM


GROWING AND SUSTAINING RELATIONSHIPS

WHAT IS CIVICRM
  • Community
  • Case Studies
  • Experts
  • Contributors
  • Core Team
  • Licensing
  • Contact Us
WILL CIVICRM MEET YOUR NEEDS?
  • Contacts
  • Contributions
  • Communications
  • Peer-To-Peer Fundraisers
  • Advocacy Campaigns
  • Events
  • Members
  • Reports
  • Case Management
GET STARTED
  • Evaluate Your CRM Needs
  • Evaluate CiviCRM Features
  • Read Books
  • Contact an Ambassador
  • Demo CiviCRM
  • Download CiviCRM
  • Download Extensions
  • Find An Expert
PARTICIPATE
  • Join the CiviCRM Community
  • Read Our Blog
  • Community Forum
  • Attend a Training or Meetup
  • Make It Happen
  • Become A CiviCRM Developer
  • Issue Tracker
  • Help with Documentation
  • Translate