Best way to present multiple confirmation messages to user

Sam Banks

I've been asked to convert a VB6 application to a WebForms environment (C# .NET v4.5). The existing application presents multiple confirmation messages when the Save button is clicked.

EG. "You have entered X, which is less than Y. Are you sure?"

They want to preserve this functionality but I'm uncomfortable with this approach of spamming the user with (potentially) 10+ questions that they have to click through in order to save. Not to mention that modern browsers allow users to disable multiple popups.

So does anyone have a more 'best practice' approach to this scenario?

Sam Banks

In case anyone else comes across this requirement, here is the solution I came up with. It's a bit rough and I need to do further work on cleaning it up, but it might provide a starting point for someone in the future.

http://jsfiddle.net/Sam_Banks/df3cewg7/

It is a simple <UL> that is built up using JQuery as a result of validation checks run when a button is clicked.

<div>
    <label for="txtCaseOne">First Input</label>
    <input id="txtCaseOne" type="text" />
</div>
<div>
    <label for="txtCaseTwo">Second Input</label>
    <input id="txtCaseTwo" type="text" />
</div>
<div>
    <input type="button" id="btnSubmit" value="OK" />
</div>
<div class="confirmationContainer">
    <div class="confirmationWindow">
        <ul class="warnings"></ul>
    </div>
</div>

Each list item consists of a message and a checkbox. The message text is clickable and takes the user to the target control so that they can check/edit a value as required.

The checkbox allows the user to register that they have confirmed the warning.

The user's confirmations are remembered so that they don't have to re-confirm if the dialog is closed & re-opened.

The page will not submit to the server unless all checkboxes have been clicked.

function submitFinalApproval() {
    var unconfirmed = $('.confirmationWindow').find('input:checkbox:not(:checked)');

    if (unconfirmed.length > 0) {
        alert("You cannot submit for Final Approval until all warnings are confirmed.");
        return false;
    }

    alert("Submitting");
    $('.confirmationWindow').dialog('close');
}

function cancelFinalApproval() {
    $('.confirmationWindow').dialog('close');
}

function saveCheckedWarnings() {
    $('.confirmationContainer').removeData();

    var checkedWarnings = $('.confirmationWindow input:checked');

    checkedWarnings.each(function () {
        var warning = $(this).parent().siblings('span').text();
        $('.confirmationContainer').data(warning, "true");
    });
}

function selectWarning(target) {
    $('.confirmationWindow').dialog('close');
    target.focus().select();
}

function appendWarning(message, target) {
    var label = $('<span>');
    label.text(message);
    label.on('click', function () {
        selectWarning(target);
    });

    var checkboxLabel = $('<label>');
    if ($('.confirmationContainer').data(message)) {
        checkboxLabel.append($('<input type="checkbox" checked="checked" />'));
    } else {
        checkboxLabel.append($('<input type="checkbox" />'));
    }
    checkboxLabel.append('OK');

    $('.warnings')
        .append($('<li>')
        .append(label)
        .append(checkboxLabel));
}

$('#btnSubmit').click(function () {

    //if page passes error validation

    $('.warnings').empty();

    // If warning condition 1 fails
    appendWarning("Please note that Condition 1 is odd. Would you like to continue?", $('#txtCaseOne'));
    // If warning condition 2 fails
    appendWarning("Condition 2 set to Fizz while Buzz. Are you sure?", $('#txtCaseTwo'));
    // If warning condition 3 fails
    appendWarning("Condition 3. Are you sure?", $('#txtCaseTwo'));

    $('.confirmationWindow').dialog('open');

    return false;
});

$('.confirmationWindow').dialog({
    autoOpen: false,
    modal: true,
    dialogClass: 'noDialogTitle',
    buttons: {
        "Submit for Final Approval": submitFinalApproval,
        Cancel: cancelFinalApproval
    },
    close: function () {
        saveCheckedWarnings();
    }
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Best way to present alternate view to user

From Dev

The best way to send file to GCS wihout user confirmation

From Dev

best way to present images in SpriteKit

From Dev

Best way to encode minimalistic messages

From Dev

Best way to authenticate user

From Dev

Best way to alert user

From Dev

Best way to check if an item is present in a list of lists?

From Dev

PHP: Best way to create and store token for confirmation email (3 options)

From Dev

What is the best way to indicate that a substitution needs a confirmation dialogue?

From Dev

PHP: Best way to create and store token for confirmation email (3 options)

From Dev

Best way to limit incoming messages to avoid duplicates

From Dev

Best way to handle mail request and messages

From Dev

The Best Way to Debug Retrofit Error Messages

From Dev

Best way to change messages from alert to labels

From Dev

Best way to store user settings

From Dev

Is there a simpler way to add user confirmation to a first_or_create method in Rails?

From Dev

Is there any way to do email confirmation for Firebase user creation and/or password reset?

From Dev

Best way to use multiple shaders

From Dev

Best way to resize multiple pictures?

From Dev

Best way for multiple layouts on Meteor

From Dev

Best way to use multiple shaders

From Dev

What's the best way to prevent a user from running the same javascript call in multiple tabs?

From Dev

What is the best way to check whether a particular string is present in a hostname or not?

From Dev

Best way to quickly and repeatedly search if value is present in a rapidly growing array?

From Dev

Best way to let user to configure Vim plugin

From Dev

Best way add NOPASSWD vagrant user?

From Dev

What is the best way to implement user account activation?

From Dev

Best Way To Access User Permissions From View

From Dev

Best way to determine if a user went offline in MySQL

Related Related

  1. 1

    Best way to present alternate view to user

  2. 2

    The best way to send file to GCS wihout user confirmation

  3. 3

    best way to present images in SpriteKit

  4. 4

    Best way to encode minimalistic messages

  5. 5

    Best way to authenticate user

  6. 6

    Best way to alert user

  7. 7

    Best way to check if an item is present in a list of lists?

  8. 8

    PHP: Best way to create and store token for confirmation email (3 options)

  9. 9

    What is the best way to indicate that a substitution needs a confirmation dialogue?

  10. 10

    PHP: Best way to create and store token for confirmation email (3 options)

  11. 11

    Best way to limit incoming messages to avoid duplicates

  12. 12

    Best way to handle mail request and messages

  13. 13

    The Best Way to Debug Retrofit Error Messages

  14. 14

    Best way to change messages from alert to labels

  15. 15

    Best way to store user settings

  16. 16

    Is there a simpler way to add user confirmation to a first_or_create method in Rails?

  17. 17

    Is there any way to do email confirmation for Firebase user creation and/or password reset?

  18. 18

    Best way to use multiple shaders

  19. 19

    Best way to resize multiple pictures?

  20. 20

    Best way for multiple layouts on Meteor

  21. 21

    Best way to use multiple shaders

  22. 22

    What's the best way to prevent a user from running the same javascript call in multiple tabs?

  23. 23

    What is the best way to check whether a particular string is present in a hostname or not?

  24. 24

    Best way to quickly and repeatedly search if value is present in a rapidly growing array?

  25. 25

    Best way to let user to configure Vim plugin

  26. 26

    Best way add NOPASSWD vagrant user?

  27. 27

    What is the best way to implement user account activation?

  28. 28

    Best Way To Access User Permissions From View

  29. 29

    Best way to determine if a user went offline in MySQL

HotTag

Archive