Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

Help with ons-prompt

  • I am using MEAN stack, with the latest version of everything.

    Is there any way to define an ons-prompt dialog in html like an alert dialog can be defined? I am having trouble locating any documentation. I can only find examples where an ons-alert is defined in html.

    Additionally, I would like to have an ‘OK’ and ‘Cancel’ button for an ons-prompt. However, in the callback, I can only receive a value for what was typed in the prompt, and not which button was pressed.

    Is the only way to add confirmation to an ons-prompt to display an ons-alert after submitting the prompt?

        message: 'How old are you?',
        callback: function(age) {
            message: 'You are ' + age + ' years old.'

    This is would I am trying to accomplish:

      title: 'Confirmation',
      buttonLabels: ['Report', 'Cancel'],
      message: 'Why do you want to report this?'
    }).then(function(answer, message){
      console.log(answer + ' ' + message);

  • Onsen UI

    @rgins16 The prompt is just an ons-alert-dialog with an input inside it. You can create your own ons-alert-dialog with that input and the buttons you need. If you want to mimic the promp, check the DOM and the CSS classes it uses.

    Another option is to make it cancelable and only provide 1 button. The user can cancel the prompt by tapping outside or accepting with an empty value. Does that make sense?

  • @Fran-Diox Yes, thank you. What you proposed is what I was thinking about doing.