Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

krajeeDialog.confirm on click event of a button #53

Open
leocharrua opened this issue Jul 15, 2024 · 0 comments
Open

krajeeDialog.confirm on click event of a button #53

leocharrua opened this issue Jul 15, 2024 · 0 comments

Comments

@leocharrua
Copy link

When the user clic a button, I need to show a confirm message before call some action.

PHP/HTML/YII2 PART:

Html::a('Optimizar', ['optimizar', 'id' => $model->id], ['onClick' => 'return confirmar_optimizar()']);

JAVASCRIPT PART:

function confirmar_optimizar() { 
    krajeeDialog.confirm('¿Está seguro de OPTIMIZAR este Camino?', 
       function (result) {
        if (result) { // ok button was pressed
            // execute your code for confirmation
            alert('OK');
            return true;
        } else { // confirmation was cancelled
            // execute your code for cancellation
            alert('CANCEL');
            return false;
        }
    });
}

But the callback event for krajeeDialog.confirm is asyncronic, then I don't have the result of the confirm for the click action ontime, and the action is allways executed.

Is there any way to handle this with krajeeDialog directly or a workaround?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant