💼 This rule is enabled in the following configs: strict-gjs, strict-gts.
💼 This rule is enabled in the following configs: strict-gjs, strict-gts.
Disallow action attribute on submit buttons.
Using the action attribute on submit buttons is a common mistake. Instead, you should use the {{on}} modifier to handle click events, or handle form submission at the form level.
This rule disallows using the action attribute on <button> elements (which default to type="submit") and <input type="submit"> elements.
<template>
<button action="save">Save</button>
</template><template>
<button type="submit" action="submit">Submit</button>
</template><template>
<input type="submit" action="go" />
</template><template>
<button {{on "click" this.handleClick}}>Save</button>
</template><template>
<button type="button" action="doSomething">Click</button>
</template><template>
<form {{on "submit" this.handleSubmit}}>
<button type="submit">Submit</button>
</form>
</template>