简体   繁体   English

vTiger和jQuery手机蒙版

[英]vTiger and jQuery phone mask

I have a phone mask that works but when I add the jQuery to vTiger header, the contact page doesn't paint. 我有一个可以使用的电话蒙版,但是当我将jQuery添加到vTiger标头时,联系页面不会显示。

In Header.tpl I have the js reference: 在Header.tpl中,我有js参​​考:

<script type="text/javascript" src="include/jquery/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="include/jquery/jquery.maskedinput.min.js"></script>

When I put the needed code in the header.tpl file, the page with the targeted phone field freezes. 当我将所需的代码放入header.tpl文件中时,带有目标电话字段的页面将冻结。

<script type="text/javascript">
jQuery(function($){
   $("#phone").mask( "999-999-9999", { placeholder : "_" } );
   });
</script>

Any ideas as to why the page won't paint is appreciated. 感谢您提供有关为何页面无法绘制的任何想法。

You should override getHeaderScripts method in Edit.php file in your module to add your library, add Mask Plugin in Contacts module, better to not modify original template files, only override: 您应该在模块的Edit.php文件中重写getHeaderScripts方法以添加库,在Contacts模块中添加Mask Plugin,最好不要修改原始模板文件,而仅重写:

class Contacts_Edit_View extends Vtiger_Edit_View {
    function getHeaderScripts(Vtiger_Request $request) {
            $headerScriptInstances = parent::getHeaderScripts($request);

            $jsFileNames = array(
                'modules.Contacts.resources.Mask'
            );

            $jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
            $headerScriptInstances = array_merge($headerScriptInstances, $jsScriptInstances);
            return $headerScriptInstances;
        }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM