Submit HTML form on self page

Oto Shavadze picture Oto Shavadze · Nov 22, 2012 · Viewed 196.4k times · Source

I want an HTML form to submit to itself. How do I use the action attribute?

  1. <form action="">
  2. <form action="#">
  3. <form action="some/address">
  4. <form>

Which was is preferable?

Answer

Milche Patern picture Milche Patern · May 28, 2013

In 2013, with all the HTML5 stuff, you can just omit the 'action' attribute to self-submit a form

<form>

Actually, the Form Submission subsection of the current HTML5 draft does not allow action="" (empty attribute). It is against the specification.

From this other Stack Overflow answer.