开发者

SugarCRM implementing AJAX calls on Custom Module fields

How can I implement AJAX calls to my custom module's one开发者_C百科 of the field. My requirement is when we change some dropdown, it should check in the database and update the result in another field in same screen. For normal modules, i See the .tpl files where I can insert script code and call. But for custom modules I didnt see the .tpl files except the cache directory (which are generating runtime). Is there any method to implement.

I am using Sugar Professional.


Here are the steps you need to follow

  1. Create a .php file which will read the values with query string and process the result as echo/print.
  2. Go to editviewdefs.php in your custom module directory (eg. /custom/modules/...)
  3. Find your field name and call a javascript function

        array (
            'name' => 'days_required_c',
            'label' => 'LBL_DAYS_REQUIRED',
            'displayParams' => 
            array (
              'field' => 
              array (
                'onChange' => 'setRenewalDate();',
              ),
            ),
          ),
    
  4. Here RenewalDate is your javascript function name.

  5. Create the script function which will call AJAX functionality like below.

    var connectionObject = 
    YAHOO.util.Connect.asyncRequest ("GET", "getnextnum.php", callback);
    YAHOO.util.Event.onContentReady("EditView", function () {
        ldelim
    } 
    
    initEditView(document.forms.EditView);
    
    //alert("Loaded"); 
    //document.getElementById("keyid_c").value = initCall();
    
    {}
    

    );

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜