# Multiple forms/actions in single view

**URL:** <https://forum.djangoproject.com/t/multiple-forms-actions-in-single-view/39957>\
**Category:** Forms & APIs\
**Created:** [March 27, 2025, 11:05pm UTC](https://forum.djangoproject.com/t/multiple-forms-actions-in-single-view/39957 "2025-03-27T23:05:03Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 29, 2025, 12:04pm UTC](https://forum.djangoproject.com/t/multiple-forms-actions-in-single-view/39957/9 "2025-03-29T12:04:59Z")

</div>

> [@anders0nmat](#):
>
> If that is the case, how would you handle form errors to those additional actions?

In your “mental model”, separate the concept of a “page” from a “view” as @philgyford points out.

Think of the views as handling actions or events. Decide what needs to happen for each case.

If I’m understanding what all you’re trying to do here, it looks like you’ve got eight distinct events.

- View 1 - returns a page:
  - First form submitted via http post, form is correct.
  - First form submitted via http post, form is incorrect.

- View 2 - returns json or html:
  - First form submitted via ajax, form is correct.
  - First form submitted via ajax, form is incorrect.

- View 3 - returns a page:
  - Second form submitted via http post, form is correct.
  - Second form submitted via http post, form is incorrect.

- View 4 - returns json or html:
  - Second form submitted via ajax, form is correct.
  - Second form submitted via ajax, form is incorrect.

If this is a correct summary, then you need to identify what needs to be returned for each of those 8 cases.

**After** you have that figured out, _then_ you can (if it appears to be desirable) factor out the common code that might be useful as a “utility function”.

---

_[View the full topic](https://forum.djangoproject.com/t/multiple-forms-actions-in-single-view/39957)._
