How to use jQuery's inputmask in AdminLTE when included via composer
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:
But still, in the page, I can see this:
While in the demo site, I can see this:
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
add a comment |
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:
But still, in the page, I can see this:
While in the demo site, I can see this:
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
afterassets:install
have you tried tocache:clear --env=prod
?
– Dan Costinel
Oct 5 '17 at 18:15
add a comment |
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:
But still, in the page, I can see this:
While in the demo site, I can see this:
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
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:
But still, in the page, I can see this:
While in the demo site, I can see this:
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
symfony twig composer-php adminlte jquery-inputmask
asked Oct 5 '17 at 9:57
Xavi MonteroXavi Montero
5,48732245
5,48732245
afterassets:install
have you tried tocache:clear --env=prod
?
– Dan Costinel
Oct 5 '17 at 18:15
add a comment |
afterassets:install
have you tried tocache: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
add a comment |
1 Answer
1
active
oldest
votes
Add this line in your js
$('[data-mask]').inputmask()
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Add this line in your js
$('[data-mask]').inputmask()
add a comment |
Add this line in your js
$('[data-mask]').inputmask()
add a comment |
Add this line in your js
$('[data-mask]').inputmask()
Add this line in your js
$('[data-mask]').inputmask()
answered Dec 16 '18 at 18:04
Ahmad ZahabiAhmad Zahabi
687
687
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
after
assets:install
have you tried tocache:clear --env=prod
?– Dan Costinel
Oct 5 '17 at 18:15