axapta - 根据用户输入启用/禁用向导的 FINISH 按钮

标签 axapta x++ dynamics-ax-2012 dynamics-ax-2012-r2

我已经使用向导在 AX 2012 中创建了一个向导...现在我需要添加 1 个功能,即根据用户输入启用或禁用 FINISH 按钮。

我已经尝试过这3种方法,但都没有成功..

this.finishenabled() -- 关于向导类的 SetupNavigation 方法

finishenabled[formrun.tabidx()] = false -- 在向导类的 SetupNavigation 方法上

syswizard.finishenable(false, curtabidx(),false) - 在向导表单的标签页上

如果有人对此有解决方案,请回复....

最佳答案

Wizard 类有一个验证方法,您将在其中执行以下操作:

boolean validate()
{
    if(SomeTestCondition)
    {
        return true;
    }
    return false;
}

根据 Microsoft 的说法,此方法执行以下操作:

Used to validate user input, and called before the wizard is closed. It returns false if user input is invalid. This will prevent the run method from being called when the user clicks the Finish button. Wizard Class on MSDN

此外,您可以在要验证的字段上使用 textchanged() 方法(或者如果不是文本,则可以使用对象的 changed 方法)。

if (this.text())
{
    if   (!sysWizard.isNextEnabled())
    {
        sysWizard.nextEnabled(true,   sysWizard.curTab(), false);
    }
}
else
{
    if   (sysWizard.isNextEnabled())
        sysWizard.nextEnabled(false,   sysWizard.curTab(), false);
}

同样来自 MSDN Enable Buttons

关于axapta - 根据用户输入启用/禁用向导的 FINISH 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16557569/

相关文章:

multithreading - 线程加工 AX 2012

X++ 循环遍历网格控件中的线

axapta - Microsoft Dynamics AX 2009 开发

axapta - 如何在Microsoft Dynamic AX的AOT中查找合适的EDT?

reporting-services - 在SSRS报告中显示条形码

axapta - 如何安全地将服务从 AX 公开到 Web?

axapta - AX 中的数据透视表

c# - 如何将数据从 SQL Server 数据库传输到 AX 2012?

lookup - 如何在 Lookup ax 2012 中选择名称(或其他字段)而不是 ID

x++ - 如何编辑树控件节点文本?