jQuery Masked Plugin Not Working

There aren’t any threads on here that have been able to help, I have also checked several other threads on StackOverflow related to masked input plugins not working and was unable to find any answers.

I should preface this by saying that my programming knowledge is rather limited. I have help, but that help isn’t always available.

I am attempting to use this Plugin

My Version #: SuiteCRM Version 7.2.1, Sugar Version 6.5.20 (Build 1001)

So I added the jQuery javascript library file and the jQuery plugin from digitalbrushes website and put them both in /admin/custom/include/javascript/

Then under the module I am currently working on which in this case is the Contracts module, the file I am working on is here: /admin/custom/modules/AOS_Contracts/views/view.edit.php

Below is the file:

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 


class AOS_ContractsViewEdit extends ViewEdit {

// function displaySubPanels() {
//  return '';
// }

function display(){
    $js = <<<JS

            <script src="/admin/custom/include/javascript/jquery.min.js" type="text/javascript">
            <script src="/admin/custom/include/javascript/jquery.maskedinput.min.js" type="text/javascript">
            var \$j = jQuery.noConflict();
                \$j("#home_phone_c").mask("(999) 999-9999");
                \$j("#work_phone_c").mask("(999) 999-9999");
                \$j("#mobile_phone_c").mask("(999) 999-9999");
        echo $js;



When I load the page and click in the fields, there is no masks present, in my chrome console I am only getting an unrelated error in my style.js file that says:

I have already tried wrapping this in {literal} tags as suggested by this answer: Adding custom jQuery validation in SugarCRM editview, nothing changed. I’m not really certain how or if the .ready(function() is applied to this if it is necessary. I didn’t think it was because of


I have tried this same page in Chrome, Firefox, Safari, and IE… nothing. I also cleared my cache and cookies after I made the changes to ensure I was getting fresh results. I have also done a quick repair and rebuild on SuiteCRM everytime (although that should be completely unnecessary) just to cover my bases.

We can’t give much help on a third party plugin but unless that plugin includes the JQuery cookie plugin (or defines it’s own) then you’ll need to include the plugin yourself. See this question on SO:


I’d recommend getting a copy of https://github.com/js-cookie/js-cookie and including it to see if this solves the problem.

Hope this helps,

Thanks for the help! I was able to fix the plugin, it ended up being 3 things:

-I needed that cookie plugin
-In my syntax above src=“jquery.maskedplugin.min.js” needed to be omitted.
-In my synatax above, $j was creating an infinite error in the chrome console that only appeared once the above syntax was removed, I omitted the ‘j’ and then that cleared it up!

Thanks for still taking the time to help!