Topic: Modal closure without displaying the message

mravandoust free asked 2 years ago

I created a login form inside the modal, but when I click on the login button, the modal closes without displaying an error or success message. I want the medal to be closed only if the login is successful, otherwise it will not be closed and will display an error message.

Dawid Wajszczuk staff commented 2 years ago

Hi. Without your code I can't see opportunity to help you. So please create a snippet showing your issue .

mravandoust free commented 2 years ago

Dawid Wajszczuk staff answered 2 years ago


Your problem is related to default behavior of 'submit' in the browsers. When you submit something, the page will reload. So you need to add e.preventDefault() to your login button in order to prevent this default behavior. Example: . You need to add validation to take place when the button is clicked or whenever you wish to make validation happen. You can use our validation which can be found here or make your own. You can also trigger some behavior on certain events related to modal. More information can be found here You can manually close modal by using hide() method. More information in previous link under Methods section.

Keep coding,

mravandoust free commented 2 years ago

Thank you for your reply

mravandoust free answered 2 years ago

Modal closure without displaying the message

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: Desktop
  • Browser: chrome
  • OS: 10
  • Provided sample code: No
  • Provided link: No