Skip to content

Latest commit

 

History

History
70 lines (50 loc) · 1.46 KB

File metadata and controls

70 lines (50 loc) · 1.46 KB

ember/template-no-form-action

💼 This rule is enabled in the following configs: strict-gjs, strict-gts.

Disallows the use of the action attribute on form elements.

In modern Ember applications, form submissions should be handled using the {{on}} modifier with the "submit" event instead of the action attribute. This provides better control and follows modern Ember patterns.

Rule Details

This rule disallows the use of the action attribute on <form> elements.

Examples

Examples of incorrect code for this rule:

<template>
  <form action="/submit">
    <input type="text" />
  </form>
</template>
<template>
  <form action="">
    <button>Submit</button>
  </form>
</template>

Examples of correct code for this rule:

<template>
  <form {{on "submit" this.handleSubmit}}>
    <input type="text" />
  </form>
</template>
<template>
  <form>
    <button type="submit">Submit</button>
  </form>
</template>

Migration

Replace:

<form action="/submit">

With:

<form {{on "submit" this.handleSubmit}}>

References