web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Validate the city field on form

(0) ShareShare
ReportReport
Posted on by

I have one ListPage form that has field CIty (EDT is LogisticsAddressCity). Now I have to validate that field, so when putting new record that field has to be only city not some random text with no sence.

How can I do that?

Thanks.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: Validate the city field on form

    Thanks, I changed the EDT to LogisticsAddressCityName and made a relation.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    298,959 Super User 2025 Season 2 on at
    RE: Validate the city field on form

    Hi Dejana,

    Have a look at the LogisticsPostalAddress table. It has to fields for managing the cities. One where you can specify text you like, the other one to check if it is a valid city based on the address setup settings.

    Verify how it has been done in standard and apply similar logic.

  • Community Member Profile Picture
    on at
    RE: Validate the city field on form

    My colleague told my that this might be some property on the field on the table. Because when i create new record new form is opened, there I have the field city and I can save whatever I want but Im supposed to not do that, it should save only existing city because the EDT of the field is LogisticsAddressCity.

  • Verified answer
    Martin Dráb Profile Picture
    236,275 Most Valuable Professional on at
    RE: Validate the city field on form

    No, modifiedField() isn't the right place. The corresponding validation method is called validateField(). modifiedField() is called later, when the change was already validated and accepted.

    Nevertheless using the standard features for maintaining database consistency sounds like a better than writing custom code, unless there are some additional requirements.

  • Basheer17 Profile Picture
    2,720 on at
    RE: Validate the city field on form

    For validations you can use modifiedField of table. But how will you validate if the entered value is valid city name. Or if you have city names stored in some table you can use lookup using table relations.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    298,959 Super User 2025 Season 2 on at
    RE: Validate the city field on form

    Hi Dejana,

    You haven't told us if you are using a custom or a standard form. Standard AX uses the logic which can be setup on the Address setup form. You can define cities per country and also enable City validation on the parameters tab page.

    If it is a customization, try to use the same logic.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans