Confirmation message reactive  list action
Question

Hi,

I would like to add a confirmation message.

Normally this is doable when using a link. However in this scenario i'm using the widget 'List', with a 'ListItem'. The 'ListItem' has the Full Swipe Right on 'Yes' and the 'ListItem' has on the 'Right Actions' an 'ListAction' that has an  'OnClick' event that triggers a Client action. In this 'List Action' there is no visible option to insert a 'ConfirmationMessage'

I would like to add the 'native' confirmation pop-up from OutSystems, so that the user needs to confirm with (yes/no) before the client action is executed.

NOTE: I know this is possible by creating a pop-up myself, but i don't really want to do this, if there is another solution.

The following is used:

  • Reactive 11
  • Widgets: 
    • List, 
    • List Item with full swipe right.

In case someone has an idea on how to fix this, without creating a pop-up myself that is opened upon executing the client-action, please let me know.

Kind regards,

Bash Nie


Solution

Hi Bash,

Within your Client Action flow, you can add a JS node with an output Boolean parameter (e.g. IsConfirmed) and the JavaScript confirm() function, and then use an If node to handle the logic according to whether it was cancelled or not.

$parameters.IsConfirmed = confirm("Are you sure you want to do this?");

I'm attaching a sample OML as a reference. Hope it helps!

ConfirmationDemo.oml

Hi @Bash Nie ,

I think confirm() JavaScript function can help you with what you want. It basically opens the native browser confirmation pop-up, which is the same as what OutSystems does for ConfirmationMessage.

You can put the JS code as the first node of the swipe action:

For the condition that user selects Yes, you can call another client action from within the JS node.

See the module with sample code I attached.

ReactivePromptDemo.oml

Hi @Bash Nie ,

I think it's always better to use what platform is providing us as they're optimized.

You can go with the @Francisco Calderón Solution for this as you just need to show confirmation box message, all you need is a Boolean variable to catch the Output YES|NO an with Confirm API from JavaScript.

@Ozan Cali provided an extension for your requirement if you still want to execute any client actions after YES|NO you can go with that answer.



With Regards,

Sandeep.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.