Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

validate dialog fields without closing the dialog window.

1,882 views
Skip to first unread message

DAXFan

unread,
Aug 6, 2007, 7:18:02 AM8/6/07
to
Hi All,

I am wondering if someone can help me. I need to validate values entered on
the dialog fields and inform the user if validation fails and keep the dialog
form open.

My problem is I can only validate values once the dialog is run and this
automatically closes the dialog window. I want to keep the dialog window open.

Any ideas?

Thanks
DAXFan

Axel Kühn

unread,
Aug 6, 2007, 9:14:02 AM8/6/07
to
Hi,

there is a article about that.

Take a look at:
http://blog.ak-home.net/PermaLink,guid,374336de-6b3d-4ce4-9d89-b11f1197bcb3.aspx

Hope that helps you.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)

DAXFan

unread,
Aug 6, 2007, 10:22:10 AM8/6/07
to
Thanks for that. But is there anyway I can see the article in english :)
Or, you can briefly mention the logic here.

Axel Kühn

unread,
Aug 6, 2007, 11:20:00 AM8/6/07
to
Hi,

yes there is a way to translate the arctile....
Just use for example http://babelfish.altavista.com/ to translate it.

Vanya Kashperuk Ivan at dot nospam

unread,
Aug 7, 2007, 5:12:02 AM8/7/07
to
Why don't you just use a simple RunBase class.
It is very easy to implement what you desire using it.

--
Kashperuk Ivan (Vanya),
Dynamics AX MCBMSS
My blog - http://kashperuk.blogspot.com
MorphX IT in Russian - http://www.lulu.com/content/723888

DAXFan

unread,
Aug 7, 2007, 9:06:05 AM8/7/07
to
Well, my class already inherits from another parent class and unfortunately
parent class does not extend runbase. My limitations are I have to extend
this parent class.

But, thanks a lot for your inputs, especially Axel.

Regards.

Jagjeet Singh

unread,
Aug 8, 2007, 3:16:47 AM8/8/07
to
Add following methods in your class

1. getfromdialog = this method is use to put values entered in the dialog
box into variable declared in the class declaration.

2. validate with boolean as return value : validate your values here using
the variable.

Cheers

DAXFan

unread,
Aug 10, 2007, 6:52:01 AM8/10/07
to
I understand.. but the getFromDialog() method does not stop the window from
closing.

I want keep the dialog window open, and just inform the user of invalid
entries.

Thanks

Jagjeet Singh

unread,
Aug 12, 2007, 10:12:01 PM8/12/07
to
Hi there,

Getfromdialog method does not do much then just copying the values enterd in
the dialog box to the variable you created in your class declaration. For
stopping the window from closing you have to write the validate method and
return false value if validation fails.

See the following example:


class dlgTest extends runbase
{
dialogfield dlgfldCust;
custAccount custAccount;
}


static void main(args _args)
{
dlgTest dlgTest = new dlgTest();

if(dlgTest.prompt())
dlgTest.run();
}

public boolean getFromDialog()
{;
custAccount = dlgfldCust.value();

return true;
}


public boolean validate(Object calledFrom)
{
boolean ret = super();

if(custAccount && !CustTable::find(custAccount))
ret = ret && CheckFailed("Invalid Customer account");

return ret;

DAXFan

unread,
Aug 13, 2007, 5:18:03 AM8/13/07
to
Thanks for that.
But the method getFromDialog() does not return a value. I checked in my
code, the method is void.
Also, how do you link the validate method to the dialog() so that validate
fail keeps the dialog window open.

Jagjeet Singh

unread,
Aug 14, 2007, 2:50:00 AM8/14/07
to
Hi there,

you don't have to call validate method system calls it by itself.

As soon as you enter the value in the field on dialog box system calls
getfromdialog method and then make a calls to validate method.

Regards


Jag

0 new messages