我需要根据自定义模块的编辑视图中选定的下拉字段值显示/隐藏某些字段。 SugarCRM CE版本是6.1.4。SugarCRM字段可见性取决于下拉字段值
我与努力:
$dictionary['<module name>']['fields']['<hidden field>']['dependency'] = 'equal($<trigger field>, "<trigger field value>")';
但它不为我工作。任何建议都是值得欢迎的。
在此先感谢
我需要根据自定义模块的编辑视图中选定的下拉字段值显示/隐藏某些字段。 SugarCRM CE版本是6.1.4。SugarCRM字段可见性取决于下拉字段值
我与努力:
$dictionary['<module name>']['fields']['<hidden field>']['dependency'] = 'equal($<trigger field>, "<trigger field value>")';
但它不为我工作。任何建议都是值得欢迎的。
在此先感谢
我用javascript代码解决了它。 模块/ 模块 /metadata/editviewdefs.php
'templateMeta' =>
array (
....
'includes'=>
array(
array('file'=>'modules/<module>/ShowHidePanel.js'),
),
'javascript' => '<script type="text/javascript" language="Javascript">showHidePanel();</script>',
...
array (
'name' => 'geometria',
'studio' => 'visible',
'label' => 'LBL_GEOMETRIA',
'displayParams' =>
array (
'javascript' => 'onchange=showHidePanel();',
),
),
和创建的文件模块/ 模块 /ShowHidePanel.js
function showHidePanel() {
if(document.getElementById('geometria').value == 'pletina') {
document.getElementById('LBL_EDITVIEW_PANEL1').style.display = 'initial';
document.getElementById('LBL_EDITVIEW_PANEL2').style.display = 'none';
document.getElementById('LBL_EDITVIEW_PANEL3').style.display = 'none';
document.getElementById('LBL_EDITVIEW_PANEL4').style.display = 'none';
document.getElementById('LBL_EDITVIEW_PANEL5').style.display = 'none';
}else if(document.getElementById('geometria').value == 'redondo') {
document.getElementById('LBL_EDITVIEW_PANEL1').style.display = 'none';
document.getElementById('LBL_EDITVIEW_PANEL2').style.display = 'initial';
document.getElementById('LBL_EDITVIEW_PANEL3').style.display = 'none';
document.getElementById('LBL_EDITVIEW_PANEL4').style.display = 'none';
document.getElementById('LBL_EDITVIEW_PANEL5').style.display = 'none';
}
}
我不那么肯定CE-版本支持据我所知,使用SugarLogic - 仅限于Pro & Enterprise。 除此之外,您的原始代码看起来很好!
以备将来参考不过,这里有一个如何正确使用依赖一个例子: http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.7/03_Module_Framework/Sugar_Logic/02_Using_Sugar_Logic_Directly/Creating_a_custom_dependency_using_metadata/
这不是为我工作。谢谢 – user3410640 2015-04-16 22:30:39