OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform Region selected from a country

This topic contains 4 replies, has 3 voices, and was last updated by  Mike Kudelya 5 years ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
  • #36982


    Hi everyone;

    I have an entity that is related to Region. Now I have a form that has three fields named : country (which is required to select a region) , region_text (which is required like the code in Oro\Bundle\AddressBundle\Form\Type\AddressType //it is hidden) and, finally region.

    this is my code in form

    When the user choose the region, he gets an error message on the region field that “this is not a valid value”. because of that the region I gt is null.

    What should I do?
    Is there a way to show just regions of one country in the region field?

    Thanks in advance.


Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #36983

    Mike Kudelya


    First of all delete your “form_row(form.country)” from template to hide it. Add AddressCountryAndRegionSubscriber to your form, how it was did in AddressType. Here is my, modified and working version of AddressCountryAndRegionSubscriber with predefined (64 line) US country, you must create your own listener on basis of this example. Further, after you do that, set your region on 93 line.



    Hi Mark,
    Thank you very much. That was so good.
    I just comment line 137 and now it works perfectly.

    Thanks again,



    I have this problem too, I see you code. it is so interesting .
    just a question if your change country will be reload data of regions before submit?
    is there solution for reloading region by select of country by user?


    Mike Kudelya


    Yes, full solution you can find on contact update page in right part of screen. Just change country.

Viewing 4 replies - 1 through 4 (of 4 total)

The forum ‘OroPlatform’ is closed to new topics and replies.

You will be redirected to [title]. Would you like to continue?

Yes No