How to add phone mask to checkout page in magento2?Magento 2 - Form ValidationStop Magento from cleaning phone number in checkoutI need add button link to a new page in Success.phtml (checkout process), how do I?Magento 2: How to add Class on Checkout Page?Checkout page phone number validationHow add mask to input with knockout javascript?Magento2 Checkout page adding buttton after phone numberHow Can I add a jquery mask to zip code input in cart?how to add content in checkout page magento 2?How To Customize Checkout Page Using One Page Checkout extension Call IWD Agency Magento 2.2.6my 2.2.6 magento checkout page do not display firstname,postcode,and telephone input field
How far can gerrymandering go?
Does the Grothendieck group of finitely generated modules form a commutative ring where the multiplication structure is induced from tensor product?
Why is quantum gravity non-renormalizable?
Classify 2-dim p-adic galois representations
I agreed to cancel a long-planned vacation (with travel costs) due to project deadlines, but now the timeline has all changed again
Wings for orbital transfer bioships?
*p++->str : Understanding evaluation of ->
Is this house-rule removing the increased effect of cantrips at higher character levels balanced?
Why doesn't SpaceX land boosters in Africa?
What is the point of using the kunai?
Could citing a database like libgen get one into trouble?
What is the function of const specifier in enum types?
What is the meaning of ゴト in the context of 鮎
When does it become illegal to exchange bitcoin for cash?
Confusion in understanding the behavior of inductor in RL circuit with DC source
What prevents a US state from colonizing a smaller state?
Installed software from source, how to say yum not to install it from package?
Why is the saxophone not common in classical repertoire?
How can I change my buffer system for protein purification?
Which high-degree derivatives play an essential role?
A world with roman numeral alphabet
Why can't i use !(single pattern) in zsh even after i turn on kshglob?
Is it advisable to inform the CEO about his brother accessing his office?
What happened to the Apollo 1 rocket?
How to add phone mask to checkout page in magento2?
Magento 2 - Form ValidationStop Magento from cleaning phone number in checkoutI need add button link to a new page in Success.phtml (checkout process), how do I?Magento 2: How to add Class on Checkout Page?Checkout page phone number validationHow add mask to input with knockout javascript?Magento2 Checkout page adding buttton after phone numberHow Can I add a jquery mask to zip code input in cart?how to add content in checkout page magento 2?How To Customize Checkout Page Using One Page Checkout extension Call IWD Agency Magento 2.2.6my 2.2.6 magento checkout page do not display firstname,postcode,and telephone input field
I need to add a mask to telephone on a checkout page, like +9-(999)-999-99-99.
magento2 onepage-checkout
add a comment |
I need to add a mask to telephone on a checkout page, like +9-(999)-999-99-99.
magento2 onepage-checkout
magento.stackexchange.com/questions/95171/…
– lalit mohan
Apr 26 '18 at 13:47
add a comment |
I need to add a mask to telephone on a checkout page, like +9-(999)-999-99-99.
magento2 onepage-checkout
I need to add a mask to telephone on a checkout page, like +9-(999)-999-99-99.
magento2 onepage-checkout
magento2 onepage-checkout
edited Apr 26 '18 at 15:50
lalit mohan
7576 silver badges29 bronze badges
7576 silver badges29 bronze badges
asked Sep 6 '17 at 8:47
AbsAbs
112 bronze badges
112 bronze badges
magento.stackexchange.com/questions/95171/…
– lalit mohan
Apr 26 '18 at 13:47
add a comment |
magento.stackexchange.com/questions/95171/…
– lalit mohan
Apr 26 '18 at 13:47
magento.stackexchange.com/questions/95171/…
– lalit mohan
Apr 26 '18 at 13:47
magento.stackexchange.com/questions/95171/…
– lalit mohan
Apr 26 '18 at 13:47
add a comment |
3 Answers
3
active
oldest
votes
If by mask you mean format it like that
so change 99999999999 to +9-(999)-999-99-99
then you could write a simple php format function something like:
$data = '+11234567890';
if( preg_match( '/^+d(d3)(d3)(d4)$/', $data, $matches ) )
$result = $matches[1] . '-' .$matches[2] . '-' . $matches[3];
return $result;
and then change the pattern to your liking
add a comment |
Why don't you take a look at at this jQuery Mask plugin? Include the script in the head of your website and then call the following below the input field:
$('#billing:telephone').mask('+0-(000)-000-00-00');
add a comment |
Hope it help you..
http://devdocs.magento.com/guides/v2.0/howdoi/checkout/checkout_zip.html
Please edit in these file in your module
Add the following in vendormagentomodule-checkoutviewfrontendlayoutcheckout_index_index.xml
example: magento2root/app/code/VendorName/ModuleName/view/frontend/layout/checkout_index_index.xml
<item name="telephone" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="customValidate" xsi:type="string">true</item>
</item>
</item>
Add custom validation as per your need in
vendormagentomagento2-baselibwebmagevalidation.js
"customValidate": [
function (phone_number, element) ,
'Please specify a valid mobile number with country code example +9-(999)-999-99-99'
],
Add following in
vendormagentomodule-uiviewbasewebjslibvalidationrules.js
"customValidate": [
function(value)
return value.length > 9 && value.match(/([+]?d1,2[.-s]?)?(d3[.-]?)2d4/g) && value.match(/^[-+]?[0-9]+$/);
,
$.mage.__('Please specify a valid mobile number')
],
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2fmagento.stackexchange.com%2fquestions%2f192152%2fhow-to-add-phone-mask-to-checkout-page-in-magento2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
If by mask you mean format it like that
so change 99999999999 to +9-(999)-999-99-99
then you could write a simple php format function something like:
$data = '+11234567890';
if( preg_match( '/^+d(d3)(d3)(d4)$/', $data, $matches ) )
$result = $matches[1] . '-' .$matches[2] . '-' . $matches[3];
return $result;
and then change the pattern to your liking
add a comment |
If by mask you mean format it like that
so change 99999999999 to +9-(999)-999-99-99
then you could write a simple php format function something like:
$data = '+11234567890';
if( preg_match( '/^+d(d3)(d3)(d4)$/', $data, $matches ) )
$result = $matches[1] . '-' .$matches[2] . '-' . $matches[3];
return $result;
and then change the pattern to your liking
add a comment |
If by mask you mean format it like that
so change 99999999999 to +9-(999)-999-99-99
then you could write a simple php format function something like:
$data = '+11234567890';
if( preg_match( '/^+d(d3)(d3)(d4)$/', $data, $matches ) )
$result = $matches[1] . '-' .$matches[2] . '-' . $matches[3];
return $result;
and then change the pattern to your liking
If by mask you mean format it like that
so change 99999999999 to +9-(999)-999-99-99
then you could write a simple php format function something like:
$data = '+11234567890';
if( preg_match( '/^+d(d3)(d3)(d4)$/', $data, $matches ) )
$result = $matches[1] . '-' .$matches[2] . '-' . $matches[3];
return $result;
and then change the pattern to your liking
answered Apr 26 '18 at 14:33
Pascal WientjesPascal Wientjes
4324 silver badges11 bronze badges
4324 silver badges11 bronze badges
add a comment |
add a comment |
Why don't you take a look at at this jQuery Mask plugin? Include the script in the head of your website and then call the following below the input field:
$('#billing:telephone').mask('+0-(000)-000-00-00');
add a comment |
Why don't you take a look at at this jQuery Mask plugin? Include the script in the head of your website and then call the following below the input field:
$('#billing:telephone').mask('+0-(000)-000-00-00');
add a comment |
Why don't you take a look at at this jQuery Mask plugin? Include the script in the head of your website and then call the following below the input field:
$('#billing:telephone').mask('+0-(000)-000-00-00');
Why don't you take a look at at this jQuery Mask plugin? Include the script in the head of your website and then call the following below the input field:
$('#billing:telephone').mask('+0-(000)-000-00-00');
answered Apr 26 '18 at 15:01
Liam McArthurLiam McArthur
8092 gold badges13 silver badges37 bronze badges
8092 gold badges13 silver badges37 bronze badges
add a comment |
add a comment |
Hope it help you..
http://devdocs.magento.com/guides/v2.0/howdoi/checkout/checkout_zip.html
Please edit in these file in your module
Add the following in vendormagentomodule-checkoutviewfrontendlayoutcheckout_index_index.xml
example: magento2root/app/code/VendorName/ModuleName/view/frontend/layout/checkout_index_index.xml
<item name="telephone" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="customValidate" xsi:type="string">true</item>
</item>
</item>
Add custom validation as per your need in
vendormagentomagento2-baselibwebmagevalidation.js
"customValidate": [
function (phone_number, element) ,
'Please specify a valid mobile number with country code example +9-(999)-999-99-99'
],
Add following in
vendormagentomodule-uiviewbasewebjslibvalidationrules.js
"customValidate": [
function(value)
return value.length > 9 && value.match(/([+]?d1,2[.-s]?)?(d3[.-]?)2d4/g) && value.match(/^[-+]?[0-9]+$/);
,
$.mage.__('Please specify a valid mobile number')
],
add a comment |
Hope it help you..
http://devdocs.magento.com/guides/v2.0/howdoi/checkout/checkout_zip.html
Please edit in these file in your module
Add the following in vendormagentomodule-checkoutviewfrontendlayoutcheckout_index_index.xml
example: magento2root/app/code/VendorName/ModuleName/view/frontend/layout/checkout_index_index.xml
<item name="telephone" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="customValidate" xsi:type="string">true</item>
</item>
</item>
Add custom validation as per your need in
vendormagentomagento2-baselibwebmagevalidation.js
"customValidate": [
function (phone_number, element) ,
'Please specify a valid mobile number with country code example +9-(999)-999-99-99'
],
Add following in
vendormagentomodule-uiviewbasewebjslibvalidationrules.js
"customValidate": [
function(value)
return value.length > 9 && value.match(/([+]?d1,2[.-s]?)?(d3[.-]?)2d4/g) && value.match(/^[-+]?[0-9]+$/);
,
$.mage.__('Please specify a valid mobile number')
],
add a comment |
Hope it help you..
http://devdocs.magento.com/guides/v2.0/howdoi/checkout/checkout_zip.html
Please edit in these file in your module
Add the following in vendormagentomodule-checkoutviewfrontendlayoutcheckout_index_index.xml
example: magento2root/app/code/VendorName/ModuleName/view/frontend/layout/checkout_index_index.xml
<item name="telephone" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="customValidate" xsi:type="string">true</item>
</item>
</item>
Add custom validation as per your need in
vendormagentomagento2-baselibwebmagevalidation.js
"customValidate": [
function (phone_number, element) ,
'Please specify a valid mobile number with country code example +9-(999)-999-99-99'
],
Add following in
vendormagentomodule-uiviewbasewebjslibvalidationrules.js
"customValidate": [
function(value)
return value.length > 9 && value.match(/([+]?d1,2[.-s]?)?(d3[.-]?)2d4/g) && value.match(/^[-+]?[0-9]+$/);
,
$.mage.__('Please specify a valid mobile number')
],
Hope it help you..
http://devdocs.magento.com/guides/v2.0/howdoi/checkout/checkout_zip.html
Please edit in these file in your module
Add the following in vendormagentomodule-checkoutviewfrontendlayoutcheckout_index_index.xml
example: magento2root/app/code/VendorName/ModuleName/view/frontend/layout/checkout_index_index.xml
<item name="telephone" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="customValidate" xsi:type="string">true</item>
</item>
</item>
Add custom validation as per your need in
vendormagentomagento2-baselibwebmagevalidation.js
"customValidate": [
function (phone_number, element) ,
'Please specify a valid mobile number with country code example +9-(999)-999-99-99'
],
Add following in
vendormagentomodule-uiviewbasewebjslibvalidationrules.js
"customValidate": [
function(value)
return value.length > 9 && value.match(/([+]?d1,2[.-s]?)?(d3[.-]?)2d4/g) && value.match(/^[-+]?[0-9]+$/);
,
$.mage.__('Please specify a valid mobile number')
],
edited Apr 26 '18 at 15:16
answered Apr 26 '18 at 15:01
lalit mohanlalit mohan
7576 silver badges29 bronze badges
7576 silver badges29 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- 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%2fmagento.stackexchange.com%2fquestions%2f192152%2fhow-to-add-phone-mask-to-checkout-page-in-magento2%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
magento.stackexchange.com/questions/95171/…
– lalit mohan
Apr 26 '18 at 13:47