ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 4 replies, has 3 voices, and was last updated by Mike Kudelya Mike Kudelya 8 months, 3 weeks ago.

  • Creator
    Topic
  • #22225

    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
  • #22424
    Mike Kudelya
    Mike Kudelya
    Oro Core

    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.

    #22442

    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

    #24912
    golriz.nourani
    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

    #24923
    Mike Kudelya
    Mike Kudelya
    Oro Core

    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)

You must be logged in to reply to this topic.