Archive for category sugarcrm

SuiteCRM / SugarCRM 6.5 add custom javascript field validation

If you need some custom validation for a field in SuiteCRM or SugarCRM 6.5, and dont find a solution. Its not your fault, its just not well documented. After some digging in code i found a very good solution.

If you want to do a custom javascript check before the EditView is saved, just add something like the following to your vardefs.php:

    'validation' => 
    array (
      'type' => 'callback',
      'callback' => 'function(formname,nameIndex){if($("#" + nameIndex).val()!=999){add_error_style(formname,nameIndex,"Only 999 is allowed!"); return false;}; return true;}',

Then do just a “Quick Repair and Rebuild” and you are done.
I hope its easy to understand, so you can adapt it to your needs.
Easy? Yes! Easy to find out? No.
But now you know.


, , ,


%d bloggers like this: