Atributo de formación HTML <button>
Ejemplo
Un formulario con dos botones de envío. El primer botón de envío envía los datos del formulario a "action_page.php", y el segundo lo envía a "action_page2.php":
<form action="/action_page.php" method="get">
<label for="fname">First name:</label>
<input type="text" id="fname"
name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<button
type="submit">Submit</button>
<button type="submit" formaction="/action_page2.php">Submit to another page</button>
</form>
Definición y uso
El formaction
atributo especifica dónde enviar los datos del formulario cuando se envía un formulario. Este atributo anula el atributo del formulario action
.
El formaction
atributo solo se usa para botones con
type="submit"
.
Compatibilidad con navegador
Los números de la tabla especifican la primera versión del navegador que es totalmente compatible con el atributo.
Attribute | |||||
---|---|---|---|---|---|
formaction | 9.0 | 10.0 | 4.0 | 5.1 | 15.0 |
Sintaxis
<button type="submit" formaction="URL">
Valores de atributo
Value | Description |
---|---|
URL | Specifies where to send the form data. Possible values:
|
❮ Etiqueta HTML <botón>