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

我已经使用向导在 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

https://stackoverflow.com/questions/16557569/

相关文章:

qt - 平均共享 QML 行中的水平空间

magento - 如何在 Magento 的 cms 页面上放置 php 语法

google-drive-api - 我如何将文件上传到我拥有具有编辑权限的共享链接的 Google

itextsharp - 使用 iTextSharp.ShowTextAligned() 添加水印

perl - Mojolicious 应用程序中的并行请求

haskell - Tree(Int,Int) 在 haskell 中是什么意思?

chef-infra - 是否有相当于 Berkshelf 的产品,但用于 Puppet 模块?

vba - 如何将 Microsoft Word 中当前选定段落的段落编号获取到 AppleScri

db2 - SQLRPGLE 中 OPEN 游标上的 SQL -302

events - Kendo multiselect,当一个项目被移除时触发一个事件