Posts Tagged javascript

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.


, , ,


jQuery.load does not work in Internet Explorer sometimes, check your HTML

Searched a while to find this. If you use jQuery.load(“site”) to add dynamic data, be sure you checked the response for html errors.
In my case i did not know exactly which little mistake made the Internet Explorer not load and insert the code to my DOM, but after tidying it up with the help of HTML-Validator in Firefox, now it works.
Now i know that it was one closing div tag too much in the dynamic loaded data. IE 8 is not tolerant at this and its hard to debug if you dont know this.

, ,

Leave a comment

%d bloggers like this: