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 7 years, 3 months ago.

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

  • Creator
    Topic
  • #36982

    farzam.sayeh
    Participant

    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.

    Farzam

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

    Mike Kudelya
    Participant

    Hi,

    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.

    #36984

    farzam.sayeh
    Participant

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

    Thanks again,
    Farzam

    #36985

    golriz.nourani
    Participant

    Hi
    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?
    Thanks
    Golriz

    #36986

    Mike Kudelya
    Participant

    Hi

    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.

Back to top