Dialog Field Disable - RunBase

I have a RunBase class where I am using a dialog to select options for selecting specific records in a grid. I’ve added a “All Records” checkbox to the dialog. When this is selected, I want to disable the dropdown for bankTransType and have it select all records regardless of type…I have the code in place to do this as well, but…

I’ve added code to the dialog:

dialog.allowUpdateOnSelectCtrl(true);

And then I’ve created a method to enable/disable the field based on my checkbox selection:

public void dialogSelectCtrl()

{

NoYesId allrecs;

;

allrecs = dialogAllTransType.value();

if(allrecs == 1)

{

dialogBankTransType.value("");

dialogBankTransType.enabled(0);

}

else

{

dialogBankTransType.enabled(1);

}

}

This works, but it doesn’t enable/disable immediately as the check box is checked or unchecked, you have to check it and then tab to the next field or click on another field in the dialog form for the dialogBankTransType dropdown to update.

Any ideas on whether there is a way I can tell X++ to update these without having to tab to the next field, or have it tab automatically in the code?

Thanks!

You need to register the modified event.

DialogField f;

f.registerOverrideMethod(‘modified’, ‘method_Modified’, this);

registerOverrideMethod() (suggested by Nuno) is a good approach, just make sure you avoid hard-coded method names. Use methodStr() for defining the names, to allow compiler to check their existence.

how can i automatically enabled or disabled the Checkbox

Call enabled(false) on the DialogField object representing the checkbox.
If it doesn’t resolve your problem, it’s time to explain what your problem is. Maybe you don’t know how to get a reference to the checkbox, maybe you actually struggle with something related to registerOverrideMethod() discussed above, maybe you have some completely different problem… We can’t know until you tell us.

Better if close the post , the answer is on this link

dynamicsuser.net/…/dialog-field-disabled-automatically