javascript - 如何在 Adob​​e-JS 自定义对话框中使用多个“确定”按钮?

标签 javascript pdf dialog livecycle-designer

我正在使用 Adob​​e Livecycle Designer ES2 制作自定义对话框,但我不知道如何或是否可以获取两个 type:"ok"- 元素在其中执行不同的操作事物。

我想在底部有一个常规的“确定”按钮,并且我想在顶部有一个指向网站的超链接。

这已经阻止我使用“ok_cancel”等,因为据我所知,这些按钮在布局中是不可分离的。
我不知道如何为启动 URL 的按钮创建事件处理程序,或者是否可以处理“ok”-“commit”之外的元素的单击事件。
另外,我不明白“提交”函数如何选择其确定按钮,因为在我的另一个对话框中,它是由位于代码底部的下部确定按钮触发的,与本例中上部按钮触发的情况不同“提交”功能。

这是我的代码,让它更清楚 - 我不希望“link”元素触发“commit”,而是“okbo”元素。我想为“link”的 clickEvent 创建一个新函数。

var dialogBox =
{
    description:
    {
        elements:
        [{  
            type: "static_text",
            name: "Text about the link",
        },
        {
            type: "ok",
            item_id: "link",
            ok_name: "Go to Link",
        },
        {
            type: "static_text",
            name: "Some more Information",
        },
        {
            type: "ok",
            item_id: "okbo"
        }]
    },
    commit: function(dialog)
    {
        app.alert("This is triggered by the OK-Button with the ID 'link' \n and I don't know why!");
    }
};
app.execDialog(dialogBox);

如果不可能在一个对话框中使用不同的“ok”元素,我愿意就如何以不同的方式在我的对话框中获取超链接提供建议!

这是我的第一个 StackOverflow 问题,所以请不要杀了我 :P ;)

最佳答案

请参阅下面更新的代码和我的评论。有关 Dialog 和 execDialog 函数的更多详细信息,请参阅 here .

一些控件没有记录,例如:

•   link_text: a hyper link control
•   mclv: a multi-column list view (or grid)
•   slider: a slider 
•   ok_help, ok_cancel_help, ok_other_help, ok_other_cancel_help controls
•   separator: draw a line horizontal or vertical with optional caption
•   Heading and Title fonts about 10pt and 12pt respectively
•   margin_width, margin_height properties for the view control
•   back_color, gradient_direction, gradient_type for the view control
•   A Dialog.setForeColorRed() method
•   A Dialog.visible() method to show/hide controls

查看更多详细信息 source

var dialogBox =
    {
        description:
        {
            elements:
            [{      
                name: "Link to google",         
                type: "link_text",  // add a hyperlink  
                item_id: "lnk1",
                alignment: "align_center",      
            },        
            {  
                type: "static_text",
                name: "Text about the link",
            },
            {
                type: "button",  // add a custom button
                item_id: "link",
                name: "Go to Link",
                alignment: "align_center",
            },
            {
                type: "static_text",
                name: "Some more Information",
            },
            {
                type: "ok",
                item_id: "okbo"
            }]
        },
            commit: function(dialog)
            {
                app.alert("okbo!"); //executed only for first ok type
            },

            "link": function () // handler of the custom component by id name
            { 
                xfa.host.gotoURL("http://www.yahoo.com");
            },

            "lnk1": function () 
            { 
                xfa.host.gotoURL("http://www.google.com");
            }

    };
    app.execDialog(dialogBox);

关于javascript - 如何在 Adob​​e-JS 自定义对话框中使用多个“确定”按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26252701/

相关文章:

c++ - 如何显示可以设置注册表项权限的对话框

Android EditTextPreference 对话框样式/主题

javascript - 无法从 Sublime Text 中的 html 访问 javascript 代码

Angular 指令未扫描 Javascript createElement

javascript - 如何制作基本的 FullCalendar 自定义 View

java - 从数据库读取时为 "Operation not allowed after ResultSet closed"

c# - iTextSharp,提交所有字段的代码

r - 使用 magick R 导入 PDF 时出错

flutter - 如何在 flutter 中创建自定义对话框

javascript - 谷歌地图模式问题