Search code examples
ibm-mobilefirstworklight-runtime

IBM Worklight 6.2 - adding text input in WL.SimpleDialog


I know by adding WL.SimpleDialog.show i can show a native style dialog/alert box with buttons. But is it possible to show the same with a textbox and yes and no buttons.


Solution

  • You cannot achieve that with WL.SimpleDialog. However, if by "textbox" you mean a dialog with an input field in it, better known as a Prompt, then you could follow my example in the following question: IBM Worklight 6.1 - How to display a prompt dialog?

    The code in your case could be like this:

    navigator.notification.prompt(
            'Replace me',  // message
            onPrompt,                  // callback to invoke
            'myPrompt',            // title
            ['Yes','No'],             // buttonLabels
            'My default text'                 // defaultText
        );
    }
    
    function onPrompt() {
        alert("prompted");
    }