Skip to Main Content
Feature Request FR-4139
Product Area APIs
Status OPEN

1 Voters

apex.message.prompt JS API

dave.waghorn Public
· Dec 9 2024

I've submitted this previously (possibly more than once) but for some reason it does not appear in my “my ideas” section or anywhere else in a search, so here it is yet again.

Idea Summary
Provide a wrapper for the native JavaScript prompt function that uses the APEX theming, in the same way as apex.message.alert and apex.message.confirm do for alert and confirm respectively.

Use Case
A common case will be providing an “other” option for checkboxes and radio buttons. A different case I'm currently working on requires users to provide a reason for selecting some options, but not others, in a list.

Using the native JavaScript prompt works ok - in the same way as using the native alert and confirm do; but the change in user interface design can be jarring for end users and having prompt available using APEX theming would provide a much improved experience without developers needing to create modal dialog regions or pages themselves for this purpose.

Preferred Solution (Optional)
As suggested in the title, and apex.message.prompt function added to the existing apex.message namespace. When utilised, it will display a confirm prompt in a modal dialog to the end user with a textbox and OK & Cancel buttons. When the end user selects OK, the prompt closes and the function returns whatever they wrote in the textbox. If they hit cancel or close the dialog, the function returns an empty string.

This idea is open.