Web - Check Box with confirmation pop up message

Hello,

I want to use a pop up confirmation message when the user change the value of  the check box.

Anyone know how i can do this?

I´ve tried to use the widget click action to click a regular link with a confirmation message, when the user changes the check box value but did not work.


Hi Pedro,

Are you on OS11?

Regards,

Daniel

no. i am still using OS 10

Hello Pedro,

As a first idea (without much thinking in the subject, I would put a container in front of it with the OnClick calling a Screen Action, that would make a modal to appear (instead of a popup) with the message and the OK/CANCEL buttons.

If the user chose ok, I programmatically change the variable associated with the checkbox and refresh the widget.

Well, just an idea :)

Cheers.

Use this with some adaptations  inside an expression with "escape content property" as "no".


The code bellow will try to find a checkbox with that id "yourcheckboxid" and when clicked, it will open a confirmation message (edit the message below to what you need). 

The first if is in case you press the yes in confirmation message. In case you choose NO i return the check box the the value it was before click. 


$('#"+yourcheckboxid+"').click(function(){

    var checked = $("input:checked").length;

    if(confirm('Are you sure you want to discontinue this program?'))

    {

        // what you want to do here. If you need a server action just use the click

        $('#"+yourid+"').click();

    }  

    else

    {

        // Return the check for the previous position case you said no in the confirmation

        if(checked = 1)

        {

            ('this:checkbox:checked').removeAttr('checked');

        }else{

            ('this:checkbox:checked').addAttr('checked');

        }

    }  

}

Where do i got this code from:

https://stackoverflow.com/questions/11832322/confirm-box-after-checking-checkbox

Came looking for a solution for it, and ended up doing it in other way than the ones described above.

I leave it here so there's another option.

In the onchange action of the checkbox, I use the Run Javascript action (from HTTPRequestHandler extension) to click in a hidden button. That button will then open a customized popup with the Confirmation message and with the buttons to proceed or cancel. Proceed button has the necessary logic and cancel closes the popup. Both buttons refresh then checkbox from the main screen.


Hope it helps.


Cheers