17
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

aタグをPOSTにする

Last updated at Posted at 2018-02-28

aタグで作ってたけどCreate、Update、DeleteだったのでCSRFのチェックを入れたくなった場合等が使いどころ。

formに名前を付ける

ループで出す際はform_nameが重複しないように。

<form name="form_name" method="POST" action="/">
    <!--CSRF-->
    <a href="javascript:form_name.submit()">POST</a>
</form>

formにnameをつけるのが面倒な場合

html5ではhrefは無くても良い(指カーソルにはならない)

<form method="POST" action="/">
    <!--CSRF-->
    <a href="javascript:void(0)" onclick="this.parentNode.submit()">POST</a>
</form>
17
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?