my.prompt

Pop up a dialog to show the prompt message.

Sample Code

copy
my.prompt({
  title: 'Title',
  message: 'Explain the current status and prompt the user solution. It is best not to exceed two lines.',
  placeholder: 'Leave a message to a friend',
  okButtonText: 'Confirm',
  cancelButtonText: 'Cancel',
  success: (result) => {
    my.alert({
      title: JSON.stringify(result),
    });
  },
});

Parameters

PropertyType

Required

Description
titleStringNoTitle of prompt box.
messageStringYesĀ Text of prompt box, which is ā€œEnter contents hereā€ by default.
placeholderStringNoPrompt text for the entry box.
alignStringNo

Message alignment. Valid values are:

  • left
  • center
  • right

The default value is centerĀ for both iOS and Android.

okButtonTextStringNoOK button text, which is OK by default.
cancelButtonTextStringNoCancel button text, which is Cancel by default.
successFunctionNoCallback function upon call success.
failFunctionNoCallback function upon call failure.
completeFunctionNoCallback function upon call completion (to be executed upon either call success or failure).

Success Callback Function

The incoming parameter is of the Object type with the following attributes:

PropertyTypeDescription
okBooleanClick OK to return true; click Cancel to return false.
inputValueStringĀ When OK is true, return the user's entry.