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

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; }));