KoderSolution Logo
HomeArticlesTutorialsForumAI LabRun Code
KoderSolution Logo

The world’s most advanced technical ecosystem for modern software engineers. Learn, build, and grow with next-generation developer tools and resources.

Engineering Newsletter

Join 100,000+ engineers receiving curated high-signal content weekly.

Platforms

  • Technical Articles
  • Interactive Tutorials
  • AI Coding Lab
  • Developer Forum
  • Developer Tools

Pages

  • About Us
  • Contact Us
  • Privacy Policy
  • Terms of Service
  • Refund Policy
  • Disclaimer
  • Advertisement

Popular Topics

  • PHP
  • Laravel
  • Python
  • React.Js
  • MySQL
© 2026 KoderSolutionAll Rights Reserved
Developed Bymaksudur.dev
🌐

HTML

Topic Hub & Articles

HTML HOME

3 min

HTML Introduction

5 min

HTML Editors

10 min

Recap Quiz

5 Questions

HTML Basic

10 min

HTML Elements

10 min

HTML Attributes

10 min

HTML Headings

10 min

HTML Styles

10 min

HTML Paragraphs

10 min

Recap Quiz

5 Questions

HTML Formatting

10 min

HTML Quotations

10 min

HTML Comments

10 min

HTML Colors

7 min

HTML CSS

10 min

Recap Quiz

5 Questions

HTML Links

10 min

HTML Images

10 min

HTML Favicon

10 min

HTML Page Title

10 min

HTML Tables

10 min

Recap Quiz

5 Questions

HTML Lists

10 min

HTML Block and Inline

10 min

HTML Classes

10 min

HTML Id

10 min

HTML Iframes

10 min

Recap Quiz

5 Questions

HTML JavaScript

10 min

HTML File Paths

10 min

HTML Head

10 min

HTML Layout

10 min

HTML Responsive

10 min

Recap Quiz

5 Questions

HTML Computercode

10 min

HTML Forms

10 min

Recap Quiz

5 Questions

HTML Form Attributes

10 min

HTML Form Elements

10 min

HTML Input Types

10 min

HTML Input Attributes

10 min

Recap Quiz

5 Questions

HTML Input Form Attributes

10 min

HTML Canvas

10 min

HTML SVG

10 min

Recap Quiz

5 Questions

HTML Media Intro

10 min

HTML Video

10 min

HTML Audio

10 min

Recap Quiz

5 Questions

HTML YouTube

10 min

HTML Geolocation

10 min

HTML Drag/Drop

10 min

HTML Local Storage

10 min

HTML Session Storage

10 min

HTML Web Workers

10 min

HTML SSE

10 min

HTML Semantics

10 min

HTML Accessibility

10 min

HTML Entities

10 min

HTML Symbols

10 min

HTML Emojis

10 min

HTML Charset

10 min

HTML URL Encode

10 min

Recap Quiz

5 Questions

HTML XHTML

10 min

HTML Global Attributes

10 min

HTML Event Attributes

10 min

HTML Color Groups

10 min

Recap Quiz

5 Questions

HTML URL Paths

10 min

HTML Summary

10 min

Progress
0%

0 / 61 Lessons

HTMLHTML Forms
Lesson

HTML Input Form Attributes

10 min reading
Free Course

HTML Input Form Attributes: Formaction, Formmethod, and Formtarget Overrides

HTML input form attributes allow individual <button> or <input type="submit"> controls inside a single form to override the default parent <form> tag attributes (action, method, enctype, target, novalidate).

Form Override Attributes Breakdown

Individual submit controls can direct form submissions to different backend routes or method verbs:

<form action="/save-draft" method="POST" id="user-form">
    <input type="text" name="content">

    <!-- Submits using default form action (/save-draft) -->
    <button type="submit">Save Draft</button>

    <!-- Overrides form action and method to publish directly -->
    <button type="submit" formaction="/publish" formmethod="POST">Publish Post</button>
    
    <!-- Submits form without running browser validation -->
    <button type="submit" formaction="/cancel" formnovalidate>Cancel</button>
</form>

Key form override attributes:

  1. formaction: Overrides the parent form's action URL destination for this specific submit button.
  2. formmethod: Overrides the HTTP method (GET or POST).
  3. formtarget: Overrides the target submission frame (_blank, _self).
  4. formenctype: Overrides the encoding type (e.g. switching to multipart/form-data).
  5. formnovalidate: Bypasses input validation rules when clicking that specific button.
  6. form: Associates an input element located outside the <form> wrapper back to its parent form ID.

Button Action Override Flow

flowchart TD
    A["Form Parent: action='/save' method='POST'"] --> B["Click 'Save Draft' Button -> Posts to /save"]
    A --> C["Click 'Publish' Button (formaction='/publish') -> Posts to /publish"]
    A --> D["Click 'Preview' Button (formtarget='_blank') -> Opens response in New Tab"]

Practical Code Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HTML Input Form Attributes Example</title>
</head>
<body style="font-family: system-ui, sans-serif; background-color: #0f172a; color: #f8fafc; padding: 2rem;">

    <h2>Multi-Action Article Editor</h2>

    <form action="/api/draft" method="POST" style="background-color: #1e293b; padding: 1.5rem; border-radius: 8px; max-width: 500px;">
        <div style="margin-bottom: 1rem;">
            <label for="article-title" style="display: block; margin-bottom: 0.5rem;">Article Title:</label>
            <input type="text" id="article-title" name="title" required style="width: 100%; padding: 8px; border-radius: 4px; border: 1px solid #334155;">
        </div>

        <div style="display: flex; gap: 10px;">
            <button type="submit" style="background-color: #475569; color: #ffffff; padding: 8px 14px; border: none; border-radius: 4px; cursor: pointer;">
                Save Draft
            </button>
            <button type="submit" formaction="/api/publish" style="background-color: #2563eb; color: #ffffff; padding: 8px 14px; border: none; border-radius: 4px; cursor: pointer;">
                Publish Now
            </button>
        </div>
    </form>

</body>
</html>

Best Practices

  • Use formaction for multi-button forms: Ideal for editor forms containing "Save Draft", "Publish", and "Delete" actions inside the same form interface.
  • Use formnovalidate on "Save Draft" or "Cancel" buttons: Allows users to save partial draft inputs without triggering required field validation errors.
  • Use the form="form-id" attribute for complex layouts: Allows placing submit buttons in fixed headers or sidebars outside the physical <form> element boundary.

Self-Check Challenge

Create a submit button inside a form that overrides the default form destination using formaction="/preview" and formtarget="_blank"!

Save Your Progress

Unlock Your
Full Potential.

Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.

Quick Access With

Enterprise-Grade Security Protocol

Recommended Courses & Books

Try it Yourself

Experiment with the code from this lesson in our interactive playground.

Open Playground

Stuck on this lesson?

Join our community of senior developers.

Ask in Forum