0

I want to display an error message on the form/listing in magento 2 back-end. I know how to show those message using a controller.

enter image description here

But how can i achieve same with JavaScript.

1 Answer 1

1

You can use Magento UI alert js for showing javascripts errors like this:

<script type="text/javascript">{
                    require(['Magento_Ui/js/modal/alert'], function (malert) {

                        function showErrorAlert() {
                            malert({
                                title: 'Error',
                                content: 'Some error occured. Please try again later.',
                                clickableOverlay: false,
                                actions: {
                                    always: function () {}
                                }
                            });
                        }
                    });
                }</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.