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
- Create a .php file which will read the values with query string and process the result as echo/print.
- Go to editviewdefs.php in your custom module directory (eg. /custom/modules/...)
Find your field name and call a javascript function
array ( 'name' => 'days_required_c', 'label' => 'LBL_DAYS_REQUIRED', 'displayParams' => array ( 'field' => array ( 'onChange' => 'setRenewalDate();', ), ), ),
Here RenewalDate is your javascript function name.
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(); {}
);
精彩评论