代码之家  ›  专栏  ›  技术社区  ›  Joril

suitecrm:在标准模块内执行自定义验证的推荐方法?

  •  0
  • Joril  · 技术社区  · 6 年前



    推荐的方法是什么?如果应用程序拒绝保存数据,我是否应该使用after_save hook并以某种方式阻止suitecrm保存数据?

    2 回复  |  直到 6 年前
        1
  •  1
  •   mrbarletta    6 年前

    addToValidateCallback("EditView", "name", "varchar", required, "invalid name", function(a,b)
    {
    return customValidationThatReturnsTrueFalse();
    })
    

    before_save 钩子。

        2
  •  0
  •   Joril    6 年前

    answer ,客户端我最终覆盖了 check_form

    // Overriding check_form() from jssource/src_files/include/javascript/sugar_3.js
    
    function check_form(formname) {
        if (typeof(siw) != 'undefined' && siw && typeof(siw.selectingSomething) != 'undefined' && siw.selectingSomething)
            return false;
    
        if (validate_form(formname, '')) {
            // SuiteCRM thinks the form is OK, let's hear my internal application
            if (my_ajax_validation_call(formname)) {
                return true;
            } else {
                alert("The internal application couldn't accept the data");
            }
        }
        return false;
    }
    

    (为了包含使用suitecrm扩展框架的自定义脚本,我做了 this