I would like to validate the DialogField
value without closing the dialog window (not in closeOK).
I'm using Dynamics 365 FFO.
class myClassCaller
{
MyClassDialog::MyPromtDialog(`parameters`);
}
class MyClassDialog
{
static container MyPromtDialog(`parameters`)
{
DialogField myDialogField;
Dialog dialog;
..........
myDialogField = dialog.addField(extendedtypestr(MYEDT),"Label","Label");
**// I would like to check/validate the DialogField value**
if (! dialog.run())
return ['', ''];
.....
return localContainer;
}
There is any way to intercept the value insert in to myDialogField
?
Yes, you need to look at registerOverrideMethod
.
You can see an example here - https://daxonline.org/1559-simple-dialog-with-field-validation-and-control-override-method.html
You would do something like
myDialogField.registerOverrideMethod(methodStr(FormStringControl, validate), methodStr(YourClass, yourValidateMethod), this);
where this
is the object where yourValidateMethod
exists.
Then you create a method similar to:
public boolean yourValidateMethod(FormControl _formControl)
{
...
}