2012-05-13 44 views
0

在SugarCRM中,我想編輯主編輯視圖,所以我可以在用戶將焦點放在其中一個文本框時調用js函數(onblur )。 我編輯了editviewdefs.php文件 - 添加了一個 'customcode' 到 'phone_work',與標籤:SugarCRM-從視圖中調用js函數(例如editviewdefs.php)

array (
    array('name'=>'last_name', 
     'displayParams'=>array('required'=>true), 
), 
    array(
    'name' => 'phone_work', 
    'customCode' => '<input name="phone_work" id="phone_work" size="30" maxlength="25" type="text" value="{$fields.phone_work.value}" onblur="hello()">' 
), 
), 

,你可以看到,我調用JS hello()函數。 我添加了js函數到jssource \ src_files \ modules \ leads \ lead.js和使用管理員重建JS壓縮文件。 功能是這樣的:

function hello() { alert('asaf'); }

它不起作用,爲什麼不調用該函數? 是在視圖中使用js函數的正確方法嗎?

回答

1

您需要將其添加到名爲custom/modules/Leads/Lead.js的js文件中。然後,您的自定義editviewdefs.php文件複製到自定義/模塊/信息/元/目錄(創建它,如果它尚未完成),這增加了它的終點......

$viewdefs['Leads']['EditView']['templateMeta']['includes'][] = 'custom/modules/Leads/Lead.js'; 

但是看因爲這東西是版本特定的,花了我幾個小時弄清楚我的版本(SugarCRM CE 5.5)更像是Leads, EditView , templateMeta, includes, file, 'path'