

#
“form”属性について
“form”属性は“form”要素の外にある“button”要素を“form”要素と関連付ける属性です。
“form”属性の値には“button”要素を関連付ける“form”要素の“id”属性の値を指定します。同じ文書にある“form”要素であれば配置場所にかかわらず関連付けることができます。
“form”属性を省略した場合は“button”要素は祖先要素となる“form”要素に関連づけられます。
#
#
サンプルコード
<form method="post" action="sample-formtag2.php" target="_blank" id="sample-form">
<fieldset>
<legend>好きな果物</legend>
<p>
<label><input type="checkbox" name="fruit[]" value="甘蕉">甘蕉</label>
<label><input type="checkbox" name="fruit[]" value="林檎">林檎</label>
<label><input type="checkbox" name="fruit[]" value="甜瓜">甜瓜</label>
<label><input type="checkbox" name="fruit[]" value="苺">苺</label>
<label><input type="checkbox" name="fruit[]" value="桃">桃</label>
</p>
</fieldset>
<fieldset>
<legend>一番好きな果物</legend>
<p>
<label><input type="radio" name="no1fruit" value="甘蕉">甘蕉</label>
<label><input type="radio" name="no1fruit" value="林檎">林檎</label>
<label><input type="radio" name="no1fruit" value="甜瓜">甜瓜</label>
<label><input type="radio" name="no1fruit" value="苺">苺</label>
<label><input type="radio" name="no1fruit" value="桃">桃</label>
</p>
</fieldset>
<fieldset>
<legend>あなたの情報</legend>
<p><label>居住地域:<input type="text" name="area"></label></p>
<p><label>年齢:<input type="number" name="age"></label></p>
</fieldset>
</form>
...
<p>
<button type="submit" form="sample-form">送信する</button>
<button type="reset" form="sample-form">やり直す</button>
</p>
...
*送信すると入力内容が表示されます。