Drupal ReadmoreJS Integration module

Drupal ReadmoreJS Integration module
Last week one of my colleague had an use case for readmorejs integration with Drupal. First of all I was surprised there wasn’t any module for it. So I helped her with a quick and dirty fix. It was to include readmore js and initialization js file in template.php. I know one should not touch ...

how to add client side phone validation in CiviCRM

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   ...

jQuery plugin to change the row color on hover 6

For my project CivCRM, I wrote a simple jquery plugin to change the row color on mouse hover. It is generic enough and can be used in any project. Here is the implementation. 1. Create a plugin file: jquery.crmrowhighlighter.js (function($){ $.fn.crmrowhighlighter = function(){ if ($(‘.crm-row-highlighter-processed’).length == 0){ $(‘.selector tr’).hover(function(){ $(this).addClass(‘crm-row-highlight’); },function(){ $(this).removeClass(‘crm-row-highlight’); }); $(‘.selector’).addClass(‘crm-row-highlighter-processed’); }; }; ...

Easiest way to sort a select element using Jquery

If you are using jquery sorting a select element is quite easy. Check the below code. $(“#select-id”).html( $(“#select-id option”).sort(function (a, b) { return a.text == b.text ? 0 : a.text < b.text ? -1 : 1; }));

How to call external site url using jQuery / AJAX 3

Recently I worked on a project where I had to pull data from an external site and populate a select on client’s website. Initially I thought it would be quite easy and straight forward. I used jQuery ajax request to fetch the data. But to my surprise I was not getting request call or any ...

iGoogle style dashboard implementation using jQuery 2

Today I have finally finished my secret project for CiviCRM v3.1. It was to implement iGoogle style dashboard  with few features specific to our project. Main base for this feature was jquery ui’s sortable, droppable and draggable plugins. It is always challenging and fun to work on such features. For complete  info check: http://civicrm.org/node/677