---
title: HTMLFormElement.reportValidity()
slug: Web/API/HTMLFormElement/reportValidity
tags:
  - HTML
  - HTMLFormElement
  - Method
  - Reference
browser-compat: api.HTMLFormElement.reportValidity
translation_of: Web/API/HTMLFormElement/reportValidity
---
<div>{{APIRef("HTML DOM")}}</div>

<p><strong><code>HTMLFormElement.reportValidity()</code></strong> メソッドは、この要素の子コントロールが制約の検証を満たしていれば <code>true</code> を返します。
  <code>false</code> が返された場合、キャンセル可能な
  <code><a href="/ja/docs/Web/API/HTMLInputElement/invalid_event">invalid</a></code> イベントが無効な子それぞれについて発行され、ユーザーに検証の問題を報告します。</p>

<h2 id="Syntax">構文</h2>

<pre class="brush: js"><em>HTMLFormElement</em>.reportValidity()
</pre>

<h3 id="Return_value">返値</h3>

<p><code>true</code> または <code>false</code></p>

<h2 id="Example">例</h2>

<pre class="brush: js">document.forms['myform'].addEventListener('submit', function() {
  document.forms['myform'].reportValidity();
}, false);</pre>

<h2 id="Specifications">仕様書</h2>

{{Specifications}}

<h2 id="Browser_compatibility">ブラウザーの互換性</h2>

<p>{{Compat}}</p>