How to use jQuery's inputmask in AdminLTE when included via composer












2















Short version



How do I use inputmask from a twig inheriting from the avanzu/AdminThemeBundle base?



Context



I'm using the AdminLTE admin panel template (https://adminlte.io/) in a symfony3 project.



To do so, I use the Avanzu project (https://github.com/avanzu/AdminThemeBundle) which allows me two main advantages:




  • I'm able to install it via composer.

  • I have pre-made twig blocks which I can just overwrite in my twigs, for reusability.


The thing is that I need an <input> in a form to express an amount in Euros. I wanted to use the inputmask which you can see in action in AdminLte here: https://adminlte.io/themes/AdminLTE/pages/forms/advanced.html



Buen when I place this code...



<div class="form-group">
<label>Intl US phone mask:</label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-phone"></i>
</div>
<input class="form-control" data-inputmask="'mask': ['999-999-9999 [x99999]', '+099 99 99 9999[9]-9999']" data-mask="" type="text">
</div>
<!-- /.input group -->
</div>


...the only thing I can see is the input box but no mask in it. Seems that the HTML works but the JS does not.



(PD: The code is a phone instead of Euros because I started copying the example to later edit it.)



Prerequisites



I have already run the php bin/console avanzu:admin:fetch-vendor command and the php bin/console assets:install --symlink both mentioned here https://github.com/avanzu/AdminThemeBundle



I also have the assetic bundle in place and pre-loaded in the kernel.



More context



In my page, I see that the main template is including all LTE javascripts:



<script src="/hello-trip/dislodge-galvanize/web/bundles/avanzuadmintheme/static/dev/scripts/admin-lte-all.js"></script>


Also if I explore admin-lte-all.js it is there and searching for inputmask reveals it is there in the minified version:



enter image description here



But still, in the page, I can see this:



enter image description here



While in the demo site, I can see this:



enter image description here



IDK what's going on or if I should do something else.



Question



What should I code in my twig to make a <input class="form-control" data-inputmask="'mask': ['999-999-9999 [x99999]', '+099 99 99 9999[9]-9999']" data-mask="" type="text"> input to work?










share|improve this question























  • after assets:install have you tried to cache:clear --env=prod?

    – Dan Costinel
    Oct 5 '17 at 18:15
















2















Short version



How do I use inputmask from a twig inheriting from the avanzu/AdminThemeBundle base?



Context



I'm using the AdminLTE admin panel template (https://adminlte.io/) in a symfony3 project.



To do so, I use the Avanzu project (https://github.com/avanzu/AdminThemeBundle) which allows me two main advantages:




  • I'm able to install it via composer.

  • I have pre-made twig blocks which I can just overwrite in my twigs, for reusability.


The thing is that I need an <input> in a form to express an amount in Euros. I wanted to use the inputmask which you can see in action in AdminLte here: https://adminlte.io/themes/AdminLTE/pages/forms/advanced.html



Buen when I place this code...



<div class="form-group">
<label>Intl US phone mask:</label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-phone"></i>
</div>
<input class="form-control" data-inputmask="'mask': ['999-999-9999 [x99999]', '+099 99 99 9999[9]-9999']" data-mask="" type="text">
</div>
<!-- /.input group -->
</div>


...the only thing I can see is the input box but no mask in it. Seems that the HTML works but the JS does not.



(PD: The code is a phone instead of Euros because I started copying the example to later edit it.)



Prerequisites



I have already run the php bin/console avanzu:admin:fetch-vendor command and the php bin/console assets:install --symlink both mentioned here https://github.com/avanzu/AdminThemeBundle



I also have the assetic bundle in place and pre-loaded in the kernel.



More context



In my page, I see that the main template is including all LTE javascripts:



<script src="/hello-trip/dislodge-galvanize/web/bundles/avanzuadmintheme/static/dev/scripts/admin-lte-all.js"></script>


Also if I explore admin-lte-all.js it is there and searching for inputmask reveals it is there in the minified version:



enter image description here



But still, in the page, I can see this:



enter image description here



While in the demo site, I can see this:



enter image description here



IDK what's going on or if I should do something else.



Question



What should I code in my twig to make a <input class="form-control" data-inputmask="'mask': ['999-999-9999 [x99999]', '+099 99 99 9999[9]-9999']" data-mask="" type="text"> input to work?










share|improve this question























  • after assets:install have you tried to cache:clear --env=prod?

    – Dan Costinel
    Oct 5 '17 at 18:15














2












2








2








Short version



How do I use inputmask from a twig inheriting from the avanzu/AdminThemeBundle base?



Context



I'm using the AdminLTE admin panel template (https://adminlte.io/) in a symfony3 project.



To do so, I use the Avanzu project (https://github.com/avanzu/AdminThemeBundle) which allows me two main advantages:




  • I'm able to install it via composer.

  • I have pre-made twig blocks which I can just overwrite in my twigs, for reusability.


The thing is that I need an <input> in a form to express an amount in Euros. I wanted to use the inputmask which you can see in action in AdminLte here: https://adminlte.io/themes/AdminLTE/pages/forms/advanced.html



Buen when I place this code...



<div class="form-group">
<label>Intl US phone mask:</label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-phone"></i>
</div>
<input class="form-control" data-inputmask="'mask': ['999-999-9999 [x99999]', '+099 99 99 9999[9]-9999']" data-mask="" type="text">
</div>
<!-- /.input group -->
</div>


...the only thing I can see is the input box but no mask in it. Seems that the HTML works but the JS does not.



(PD: The code is a phone instead of Euros because I started copying the example to later edit it.)



Prerequisites



I have already run the php bin/console avanzu:admin:fetch-vendor command and the php bin/console assets:install --symlink both mentioned here https://github.com/avanzu/AdminThemeBundle



I also have the assetic bundle in place and pre-loaded in the kernel.



More context



In my page, I see that the main template is including all LTE javascripts:



<script src="/hello-trip/dislodge-galvanize/web/bundles/avanzuadmintheme/static/dev/scripts/admin-lte-all.js"></script>


Also if I explore admin-lte-all.js it is there and searching for inputmask reveals it is there in the minified version:



enter image description here



But still, in the page, I can see this:



enter image description here



While in the demo site, I can see this:



enter image description here



IDK what's going on or if I should do something else.



Question



What should I code in my twig to make a <input class="form-control" data-inputmask="'mask': ['999-999-9999 [x99999]', '+099 99 99 9999[9]-9999']" data-mask="" type="text"> input to work?










share|improve this question














Short version



How do I use inputmask from a twig inheriting from the avanzu/AdminThemeBundle base?



Context



I'm using the AdminLTE admin panel template (https://adminlte.io/) in a symfony3 project.



To do so, I use the Avanzu project (https://github.com/avanzu/AdminThemeBundle) which allows me two main advantages:




  • I'm able to install it via composer.

  • I have pre-made twig blocks which I can just overwrite in my twigs, for reusability.


The thing is that I need an <input> in a form to express an amount in Euros. I wanted to use the inputmask which you can see in action in AdminLte here: https://adminlte.io/themes/AdminLTE/pages/forms/advanced.html



Buen when I place this code...



<div class="form-group">
<label>Intl US phone mask:</label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-phone"></i>
</div>
<input class="form-control" data-inputmask="'mask': ['999-999-9999 [x99999]', '+099 99 99 9999[9]-9999']" data-mask="" type="text">
</div>
<!-- /.input group -->
</div>


...the only thing I can see is the input box but no mask in it. Seems that the HTML works but the JS does not.



(PD: The code is a phone instead of Euros because I started copying the example to later edit it.)



Prerequisites



I have already run the php bin/console avanzu:admin:fetch-vendor command and the php bin/console assets:install --symlink both mentioned here https://github.com/avanzu/AdminThemeBundle



I also have the assetic bundle in place and pre-loaded in the kernel.



More context



In my page, I see that the main template is including all LTE javascripts:



<script src="/hello-trip/dislodge-galvanize/web/bundles/avanzuadmintheme/static/dev/scripts/admin-lte-all.js"></script>


Also if I explore admin-lte-all.js it is there and searching for inputmask reveals it is there in the minified version:



enter image description here



But still, in the page, I can see this:



enter image description here



While in the demo site, I can see this:



enter image description here



IDK what's going on or if I should do something else.



Question



What should I code in my twig to make a <input class="form-control" data-inputmask="'mask': ['999-999-9999 [x99999]', '+099 99 99 9999[9]-9999']" data-mask="" type="text"> input to work?







symfony twig composer-php adminlte jquery-inputmask






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 5 '17 at 9:57









Xavi MonteroXavi Montero

5,48732245




5,48732245













  • after assets:install have you tried to cache:clear --env=prod?

    – Dan Costinel
    Oct 5 '17 at 18:15



















  • after assets:install have you tried to cache:clear --env=prod?

    – Dan Costinel
    Oct 5 '17 at 18:15

















after assets:install have you tried to cache:clear --env=prod?

– Dan Costinel
Oct 5 '17 at 18:15





after assets:install have you tried to cache:clear --env=prod?

– Dan Costinel
Oct 5 '17 at 18:15












1 Answer
1






active

oldest

votes


















0














Add this line in your js



 $('[data-mask]').inputmask()





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46582821%2fhow-to-use-jquerys-inputmask-in-adminlte-when-included-via-composer%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Add this line in your js



     $('[data-mask]').inputmask()





    share|improve this answer




























      0














      Add this line in your js



       $('[data-mask]').inputmask()





      share|improve this answer


























        0












        0








        0







        Add this line in your js



         $('[data-mask]').inputmask()





        share|improve this answer













        Add this line in your js



         $('[data-mask]').inputmask()






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 16 '18 at 18:04









        Ahmad ZahabiAhmad Zahabi

        687




        687
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46582821%2fhow-to-use-jquerys-inputmask-in-adminlte-when-included-via-composer%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            Npm cannot find a required file even through it is in the searched directory