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

            Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

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

            Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form