I’m trying to fully understand how the confirm()
method of the ko/dialogs module works. According to its documentation – at least, the description of the “yes” and “no” properties, but not the description of the method itself – the method should present a dialog box with two buttons, allowing the user to choose either yes or no. But I can’t seem to get two buttons to display. Every combination I have tried so far results in just a single “OK” button. Please see the code below, in which I have commented on the output I’m seeing.
var d = require( "ko/dialogs" );
dialogs_module_confirm__test();
function dialogs_module_confirm__test(
) {
// Only displayed is a OK button, but no Cancel button.
var return_value = d.alert( "confirm() message" );
// The method always returns false even though the user is choosing the OK button.
assert( ! return_value );
// The button label is not given the value specified here.
d.alert( "confirm() override labels", { yes: "Okey-dokey", no: "No way, Jose" } );
}
The three questions I have are:
- How I can get the two buttons to be shown instead of just one?
- How can I change the labels of the buttons?
- Why does the method always returns false even though the user is clicking the OK button (which is generally considered an affirmative response and not negative)?