Topic: Opening an action menu inside the editor submits the form

kaiBuilds63 pro asked 6 days ago


Our appointment editor contains a form with Save at the bottom and a small actions dropdown near the title. Clicking the dropdown trigger calls the form's submit handler even when no menu item is selected.

The trigger is a plain button inside the form. We did not give it a type because it is only intended to open the menu. Save already has type set to submit, and the form uses an ngSubmit binding.



A button associated with a form defaults to submit when its type is omitted. Set type=button on the dropdown trigger so opening the menu does not invoke ngSubmit. Keep type=submit only on the action intended to save the form.

Check the menu's other button actions for the same omission. This allows the form's normal submit behavior to remain intact, including submitting from an appropriate text input, without treating every toolbar interaction as a save request.

<button type="button">
  <!-- Keep the existing dropdown trigger binding here. -->
  Actions
</button>

https://mdbootstrap.com/docs/angular/components/dropdowns/

https://mdbootstrap.com/docs/angular/components/buttons/



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: MDB5 9.1.0
  • Device: Desktop
  • Browser: Safari
  • OS: macOS
  • Provided sample code: No
  • Provided link: No