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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Prevent closing a dialog

(0) ShareShare
ReportReport
Posted on by

Hi all,
i have a dialog which contains some mandatory fields and if these fields are empty the dialog must not be closed.

So i extend the Dialog class and implement some code. Now i want to execute my "mandatory field" logic. But i can't find a way to place my logic (to prevent the dialog being closed...). I tried to overwrite close, but close is never executed???

Any ideas?

Frank

*This post is locked for comments

I have the same question (0)
  • Neeraj Chawla Profile Picture
    1,147 on at

    Please clarify.

  • Community Member Profile Picture
    on at

    Hi,

    thanks for your reply.

    I try to explain my steps:

    I wrote 2 new classes: The first extends the Dialog class and the second extends the DialogField class.

    In the extended DialogField class i added a Mandatory field.

    In the extended Dialog class i wrote my own addField method to set the mandatory-Field. In this class i overwrite the close method (to validate the mandotory fields and prevent the form from closing if required) - but the code in close is never executed. And the form is still closed, even if i uncomment the super()....

    Frank

  • Verified answer
    Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    You have to understand than the Dialog class is not the form itself - it has close() method that calls form's close(), but there is no call in the opposite direction. You would have to modify the Dialog form.

    But I wouldn't do that unless really necessary - you can implement a RunBase class, override its validate() method and you have the requested behavior. Or you can at least take a look to the closeOk() method of the Dialog form to see how it's handled for RunBase classes.

  • Neeraj Chawla Profile Picture
    1,147 on at

    Dear Frank,

    I think there is problem with your code. I  completely agree with the Martin's Reply on this post. Just check your code and try to modifying your code as per Martin's Reply.

  • Community Member Profile Picture
    on at

    Hello,

    thanks for your suggestions. I will take a look at them :).

    Frank

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans