I've found several posts and articles around the net talking about validating form fields in dialogs, but none of the examples I've found seem to work properly.
Can someone post a complete, concise example of x++ code that generates a dialog containing a single text field, performs simple validation (if text = "abc") on it, and either closes the window (returning the field value) if validation passes or generates an Infolog warning without closing the dialog if validation fails.
For those of us just beginning in x++, I think it would be a great starting point to have an actual working example to build on.
Thanks!
Here is an example in AX 2009 of how to build a simple dialog using the RunBase class. In it I create a class called DialogExample and derive from RunBase. To show the dialog you simply need to run the class, but typically this would be done by pointing a MenuItem at the class.
Typically in this scenario logic that needs to be run would be put in a run method on the class and then called into from main if the Ok button is clicked. Since the run method would be an instance method this gets rid of the need for the parm methods to access the value of the field on the dialog.
I know this is an old question but it should also be noted that for people starting out in the world of AX development, there are great working code examples in the AOT, look for the Forms and Classes which have the prefix "Tutorial_".
Tutorial_RunBaseForm is a class in the AOT which gives you exactly what you need.