magento 2.2 add validation to checkout region input fieldMagento 2.2 Input field validation on Checkout pageMagento2 - Modify Checkout pagehow to delete an input field in knockoutjs template in magento2validation not working - magento 2Magento 2 checkout input field validation possibilityMagento 2 - change the form fields sort order in checkoutHow to apply custom validation in Magento 2 checkout Shipping Address form?Magento 2 checkout custom field validationMagento 2.2.1: Add Custom Upload file attribute in CheckoutMagento 2: Data validation message input fieldMagento 2 : How add validation validator to custom input field in checkout page?
Do Iron Man suits sport waste management systems?
Is this answer explanation correct?
Could the museum Saturn V's be refitted for one more flight?
What is required to make GPS signals available indoors?
What exactly is ineptocracy?
Using "tail" to follow a file without displaying the most recent lines
Do creatures with a listed speed of "0 ft., fly 30 ft. (hover)" ever touch the ground?
What is an equivalently powerful replacement spell for the Yuan-Ti's Suggestion spell?
How obscure is the use of 令 in 令和?
In the UK, is it possible to get a referendum by a court decision?
How badly should I try to prevent a user from XSSing themselves?
How can saying a song's name be a copyright violation?
Notepad++ delete until colon for every line with replace all
Why do I get negative height?
What reasons are there for a Capitalist to oppose a 100% inheritance tax?
One verb to replace 'be a member of' a club
Getting extremely large arrows with tikzcd
Does Dispel Magic work on Tiny Hut?
Processor speed limited at 0.4 Ghz
How seriously should I take size and weight limits of hand luggage?
What historical events would have to change in order to make 19th century "steampunk" technology possible?
Why were 5.25" floppy drives cheaper than 8"?
Finding the error in an argument
Mathematica command that allows it to read my intentions
magento 2.2 add validation to checkout region input field
Magento 2.2 Input field validation on Checkout pageMagento2 - Modify Checkout pagehow to delete an input field in knockoutjs template in magento2validation not working - magento 2Magento 2 checkout input field validation possibilityMagento 2 - change the form fields sort order in checkoutHow to apply custom validation in Magento 2 checkout Shipping Address form?Magento 2 checkout custom field validationMagento 2.2.1: Add Custom Upload file attribute in CheckoutMagento 2: Data validation message input fieldMagento 2 : How add validation validator to custom input field in checkout page?
following this post (Magento 2.2 Input field validation on Checkout page)
I can successfully add validation on the company field. But when I apply that to the region field
, it doesn't work anymore. By "doesnt work" I mean that I get no validation message at all, I can write whatever I want in the region field and I get no red message.
What I need is to validate the region field so that the user can write only 2 characters. How can I do that?
What I did:
1. created checkout_index_index.xml in my theme under app/design/frontend/Theme/default/Magento_Checkout/layout
2. Add the code specified in the post mentioned above
3. substitute "company" with "region"
Final xml:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="shipping-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="shippingAddress" xsi:type="array">
<item name="children" xsi:type="array">
<!-- To affect the shipping address fields -->
<item name="shipping-address-fieldset" xsi:type="array">
<item name="children" xsi:type="array">
<item name="region" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="min_text_length" xsi:type="number">0</item>
<item name="max_text_length" xsi:type="number">9</item>
<item name="letters-only" xsi:type="boolean">true</item>
<item name="required-entry" xsi:type="boolean">true</item>
<item name="max-words" xsi:type="number">2</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
As I said, If I change "region" with "company", it works perfectly. But I need to apply the validation to the region field. Any idea how to achieve this?
Thanks
checkout magento2.2 validation
add a comment |
following this post (Magento 2.2 Input field validation on Checkout page)
I can successfully add validation on the company field. But when I apply that to the region field
, it doesn't work anymore. By "doesnt work" I mean that I get no validation message at all, I can write whatever I want in the region field and I get no red message.
What I need is to validate the region field so that the user can write only 2 characters. How can I do that?
What I did:
1. created checkout_index_index.xml in my theme under app/design/frontend/Theme/default/Magento_Checkout/layout
2. Add the code specified in the post mentioned above
3. substitute "company" with "region"
Final xml:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="shipping-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="shippingAddress" xsi:type="array">
<item name="children" xsi:type="array">
<!-- To affect the shipping address fields -->
<item name="shipping-address-fieldset" xsi:type="array">
<item name="children" xsi:type="array">
<item name="region" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="min_text_length" xsi:type="number">0</item>
<item name="max_text_length" xsi:type="number">9</item>
<item name="letters-only" xsi:type="boolean">true</item>
<item name="required-entry" xsi:type="boolean">true</item>
<item name="max-words" xsi:type="number">2</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
As I said, If I change "region" with "company", it works perfectly. But I need to apply the validation to the region field. Any idea how to achieve this?
Thanks
checkout magento2.2 validation
Instead of region give as region_id not sure but guessing that would work out @Lounik
– Prathap Gunasekaran
18 hours ago
add a comment |
following this post (Magento 2.2 Input field validation on Checkout page)
I can successfully add validation on the company field. But when I apply that to the region field
, it doesn't work anymore. By "doesnt work" I mean that I get no validation message at all, I can write whatever I want in the region field and I get no red message.
What I need is to validate the region field so that the user can write only 2 characters. How can I do that?
What I did:
1. created checkout_index_index.xml in my theme under app/design/frontend/Theme/default/Magento_Checkout/layout
2. Add the code specified in the post mentioned above
3. substitute "company" with "region"
Final xml:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="shipping-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="shippingAddress" xsi:type="array">
<item name="children" xsi:type="array">
<!-- To affect the shipping address fields -->
<item name="shipping-address-fieldset" xsi:type="array">
<item name="children" xsi:type="array">
<item name="region" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="min_text_length" xsi:type="number">0</item>
<item name="max_text_length" xsi:type="number">9</item>
<item name="letters-only" xsi:type="boolean">true</item>
<item name="required-entry" xsi:type="boolean">true</item>
<item name="max-words" xsi:type="number">2</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
As I said, If I change "region" with "company", it works perfectly. But I need to apply the validation to the region field. Any idea how to achieve this?
Thanks
checkout magento2.2 validation
following this post (Magento 2.2 Input field validation on Checkout page)
I can successfully add validation on the company field. But when I apply that to the region field
, it doesn't work anymore. By "doesnt work" I mean that I get no validation message at all, I can write whatever I want in the region field and I get no red message.
What I need is to validate the region field so that the user can write only 2 characters. How can I do that?
What I did:
1. created checkout_index_index.xml in my theme under app/design/frontend/Theme/default/Magento_Checkout/layout
2. Add the code specified in the post mentioned above
3. substitute "company" with "region"
Final xml:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="shipping-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="shippingAddress" xsi:type="array">
<item name="children" xsi:type="array">
<!-- To affect the shipping address fields -->
<item name="shipping-address-fieldset" xsi:type="array">
<item name="children" xsi:type="array">
<item name="region" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="min_text_length" xsi:type="number">0</item>
<item name="max_text_length" xsi:type="number">9</item>
<item name="letters-only" xsi:type="boolean">true</item>
<item name="required-entry" xsi:type="boolean">true</item>
<item name="max-words" xsi:type="number">2</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
As I said, If I change "region" with "company", it works perfectly. But I need to apply the validation to the region field. Any idea how to achieve this?
Thanks
checkout magento2.2 validation
checkout magento2.2 validation
edited 18 hours ago
Ronak Rathod
892212
892212
asked 18 hours ago
LounikLounik
363
363
Instead of region give as region_id not sure but guessing that would work out @Lounik
– Prathap Gunasekaran
18 hours ago
add a comment |
Instead of region give as region_id not sure but guessing that would work out @Lounik
– Prathap Gunasekaran
18 hours ago
Instead of region give as region_id not sure but guessing that would work out @Lounik
– Prathap Gunasekaran
18 hours ago
Instead of region give as region_id not sure but guessing that would work out @Lounik
– Prathap Gunasekaran
18 hours ago
add a comment |
1 Answer
1
active
oldest
votes
Please go to admin
Store->Configuration->General->State Options(Select Your Region. You Want to required).
After Cache Flush.
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%2f268345%2fmagento-2-2-add-validation-to-checkout-region-input-field%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
Please go to admin
Store->Configuration->General->State Options(Select Your Region. You Want to required).
After Cache Flush.
add a comment |
Please go to admin
Store->Configuration->General->State Options(Select Your Region. You Want to required).
After Cache Flush.
add a comment |
Please go to admin
Store->Configuration->General->State Options(Select Your Region. You Want to required).
After Cache Flush.
Please go to admin
Store->Configuration->General->State Options(Select Your Region. You Want to required).
After Cache Flush.
answered 17 hours ago
mohit vamjamohit vamja
965
965
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%2f268345%2fmagento-2-2-add-validation-to-checkout-region-input-field%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
Instead of region give as region_id not sure but guessing that would work out @Lounik
– Prathap Gunasekaran
18 hours ago