Often when creating edit views in any application there is a need to have complex validation rules. Most of the time more than one field is evaluated to validate the data entered. SugarCrm have a lot of built in support for single field validations but if you want multiple fields in a validations rule or interdependencies between fields you will need to code this yourself.
A way to achieve this would be to generate the initial edit view in module builder and then manually change the generated code file. Depending on the way you implement the code changes and validation this file might no longer be module builder compatible.
This posting will explain how you can modify SugarCrm 5.5.2 code to add support for custom JavaScript in the module builder to validate form. Error messages will be presented to the user like all other validation error messages.
1. Go to Admin -> ModuleBuilder. Open desired package/module/fields.
2. Add new field (select a suitable field type).
3. In the field edit screen there are 3 new fields: JS function name, JS function code and JS Error message.
4. In JS function name only enter the function name without parentheses like check_dates.
5. In JS function code enter the full JavaScript function code including the function keyword.
6. In JS error message enter the custom error message.
...
Please read the entire posting at http://kenneththorman.blogspot.com/2...cripts-in.html
Regards
Kenneth Thorman


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks