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?













0















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










share|improve this question
























  • Instead of region give as region_id not sure but guessing that would work out @Lounik

    – Prathap Gunasekaran
    18 hours ago















0















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










share|improve this question
























  • Instead of region give as region_id not sure but guessing that would work out @Lounik

    – Prathap Gunasekaran
    18 hours ago













0












0








0








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










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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










1 Answer
1






active

oldest

votes


















0















Please go to admin




Store->Configuration->General->State Options(Select Your Region. You Want to required).



After Cache Flush.






share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    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









    0















    Please go to admin




    Store->Configuration->General->State Options(Select Your Region. You Want to required).



    After Cache Flush.






    share|improve this answer



























      0















      Please go to admin




      Store->Configuration->General->State Options(Select Your Region. You Want to required).



      After Cache Flush.






      share|improve this answer

























        0












        0








        0








        Please go to admin




        Store->Configuration->General->State Options(Select Your Region. You Want to required).



        After Cache Flush.






        share|improve this answer














        Please go to admin




        Store->Configuration->General->State Options(Select Your Region. You Want to required).



        After Cache Flush.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 17 hours ago









        mohit vamjamohit vamja

        965




        965



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

            Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?