teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

修正

2020/07/31 04:39

投稿

ForestSeo
ForestSeo

スコア2724

answer CHANGED
@@ -21,4 +21,4 @@
21
21
  ```
22
22
  > 同じname属性をもつformは一番最後の値が適用されるらしいのでうまくいきませんでした。
23
23
 
24
- `id="{{forloop.counter}}"`にして、formを1回目のnameは1、2回目のnameは2 とする。
24
+ `name="{{forloop.counter}}"`にして、formを1回目のnameは1、2回目のnameは2 とする。

1

修正

2020/07/31 04:39

投稿

ForestSeo
ForestSeo

スコア2724

answer CHANGED
@@ -7,7 +7,7 @@
7
7
  <th class="py-1">mail</th>
8
8
  </tr>
9
9
  {% for item in data %}
10
- <form action="{% url 'sendmail:index' %}" method="POST" id="{{forloop.counter}}">
10
+ <form action="{% url 'sendmail:index' %}" method="POST" name="{{forloop.counter}}">
11
11
  <tr>
12
12
  <td class="py-2">{{ Send_Form.as_p }}{% csrf_token %}</td>
13
13
  <td class="py-2">{{item.gender}}</td>
@@ -18,4 +18,7 @@
18
18
  </form>
19
19
  {% endfor %}
20
20
  </table>
21
+ ```
22
+ > 同じname属性をもつformは一番最後の値が適用されるらしいのでうまくいきませんでした。
23
+
21
- ````id="{{forloop.counter}}"`にして、formを1回目のidは1、2回目のidは2 とする。
24
+ `id="{{forloop.counter}}"`にして、formを1回目のnameは1、2回目のnameは2 とする。