IBM Worklight 6.1 - How to display a prompt dialog? [closed]

余生长醉 提交于 2019-12-08 06:47:56

问题


It was able to display a prompt box in common resources ("preview as common resources"), but it is not working in the Android Emualtor.

What is the reason?


回答1:


Have you tried using Cordova's navigator.prompt?

For example, in common\main.js:

function wlCommonInit() {
    navigator.notification.prompt(
        'Please enter your name',  // message
        onPrompt,                  // callback to invoke
        'Registration',            // title
        ['Ok','Exit'],             // buttonLabels
        'Jane Doe'                 // defaultText
    );
}

function onPrompt() {
    alert("prompted");
}

I tested this in iOS, but it will work in Android as well.

When previewing your application, use some stub or "regular" JS implementation, but for the mobile environments, use Cordova's.



来源:https://stackoverflow.com/questions/22837521/ibm-worklight-6-1-how-to-display-a-prompt-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!