Skip to content

Commit

Permalink
2023/04/07 時点の英語版に同期
Browse files Browse the repository at this point in the history
  • Loading branch information
mfuji09 committed Jun 16, 2023
1 parent b6d3ff2 commit f445a0d
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 71 deletions.
9 changes: 5 additions & 4 deletions files/ja/web/api/htmlformelement/acceptcharset/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
title: HTMLFormElement.acceptCharset
title: "HTMLFormElement: acceptCharset プロパティ"
short-title: acceptCharset
slug: Web/API/HTMLFormElement/acceptCharset
l10n:
sourceCommit: 277e5969c63b97cfb55ab4a0e612e8040810f49b
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{APIRef("HTML DOM")}}

**`HTMLFormElement.acceptCharset`** プロパティは、指定された {{htmlelement("form")}} 要素で対応している[文字エンコーディング](/ja/docs/Glossary/character_encoding) の一覧を表します。このリストは、カンマ区切りまたはスペース区切りで記述することができます。
**`HTMLFormElement.acceptCharset`** プロパティは、指定された {{htmlelement("form")}} 要素で対応している[文字エンコーディング](/ja/docs/Glossary/Character_encoding) の一覧を表します。このリストは、カンマ区切りまたはスペース区切りで記述することができます。

##

Expand All @@ -16,7 +17,7 @@ l10n:
##

```js
let inputs = document.forms['myform'].acceptCharset;
let inputs = document.forms["myform"].acceptCharset;
```

## 仕様書
Expand Down
7 changes: 4 additions & 3 deletions files/ja/web/api/htmlformelement/action/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
title: HTMLFormElement.action
title: "HTMLFormElement: action プロパティ"
short-title: action
slug: Web/API/HTMLFormElement/action
l10n:
sourceCommit: 277e5969c63b97cfb55ab4a0e612e8040810f49b
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{APIRef("HTML DOM")}}
Expand All @@ -18,7 +19,7 @@ l10n:
##

```js
form.action = '/cgi-bin/publish';
form.action = "/cgi-bin/publish";
```

## 仕様書
Expand Down
20 changes: 15 additions & 5 deletions files/ja/web/api/htmlformelement/elements/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
title: HTMLFormElement.elements
title: "HTMLFormElement: elements プロパティ"
short-title: elements
slug: Web/API/HTMLFormElement/elements
l10n:
sourceCommit: 03f91ed2e2c6123fbf711f1759c7e99a2dc63de6
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{APIRef("HTML DOM")}}
Expand Down Expand Up @@ -43,9 +44,18 @@ HTML 5 より前のバージョンでは、返されるオブジェクトは {{d

```html
<form id="my-form">
<input type="text" name="username" />
<input type="text" name="full-name" />
<input type="password" name="password" />
<label>
ユーザー名:
<input type="text" name="username" />
</label>
<label>
フルネーム:
<input type="text" name="full-name" />
</label>
<label>
パスワード:
<input type="password" name="password" />
</label>
</form>
```

Expand Down
5 changes: 3 additions & 2 deletions files/ja/web/api/htmlformelement/encoding/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
title: HTMLFormElement.encoding
title: "HTMLFormElement: encoding プロパティ"
short-title: encoding
slug: Web/API/HTMLFormElement/encoding
l10n:
sourceCommit: 277e5969c63b97cfb55ab4a0e612e8040810f49b
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{APIRef("HTML DOM")}}
Expand Down
7 changes: 4 additions & 3 deletions files/ja/web/api/htmlformelement/enctype/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
title: HTMLFormElement.enctype
title: "HTMLFormElement: enctype プロパティ"
short-title: enctype
slug: Web/API/HTMLFormElement/enctype
l10n:
sourceCommit: 277e5969c63b97cfb55ab4a0e612e8040810f49b
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{APIRef("HTML DOM")}}
Expand All @@ -22,7 +23,7 @@ l10n:
##

```js
form.enctype = 'application/x-www-form-urlencoded';
form.enctype = "application/x-www-form-urlencoded";
```

## 仕様書
Expand Down
27 changes: 14 additions & 13 deletions files/ja/web/api/htmlformelement/formdata_event/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
title: 'HTMLFormElement: formdata イベント'
title: "HTMLFormElement: formdata イベント"
short-title: formdata
slug: Web/API/HTMLFormElement/formdata_event
l10n:
sourceCommit: 277e5969c63b97cfb55ab4a0e612e8040810f49b
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{APIRef}}
Expand All @@ -16,9 +17,9 @@ l10n:
このイベント名を {{domxref("EventTarget.addEventListener", "addEventListener()")}} 等のメソッドで使用するか、イベントハンドラープロパティを使用するかしてください。

```js
addEventListener('formdata', (event) => {});
addEventListener("formdata", (event) => {});

onformdata = (event) => { };
onformdata = (event) => {};
```

## イベント型
Expand All @@ -39,11 +40,11 @@ _親インターフェイスである {{domxref("Event")}} から継承したプ
```js
// フォームの参照を得る

const formElem = document.querySelector('form');
const formElem = document.querySelector("form");

// submit ハンドラー

formElem.addEventListener('submit', (e) => {
formElem.addEventListener("submit", (e) => {
// フォームの送信時、既定の動作を抑止
e.preventDefault();

Expand All @@ -53,8 +54,8 @@ formElem.addEventListener('submit', (e) => {
// FormData オブジェクトを構築し、 formdata イベントが発行される
const formData = new FormData(formElem);
// formdata は formdata イベントで変更されます。
console.log(formData.get('field1')); // foo
console.log(formData.get('field2')); // bar
console.log(formData.get("field1")); // foo
console.log(formData.get("field2")); // bar
});

// データを受け取るための formdata ハンドラー
Expand All @@ -65,21 +66,21 @@ formElem.addEventListener('formdata', (e) => {
// イベントオブジェクトからフォームデータを取得する
const formData = e.formData;
// formdata イベントでフォームデータを変更する
formData.set('field1', formData.get('field1').toLowerCase());
formData.set('field2', formData.get('field2').toLowerCase());
formData.set("field1", formData.get("field1").toLowerCase());
formData.set("field2", formData.get("field2").toLowerCase());
});
```

`onformdata` 版はこのようになります。

```js
formElem.onformdata = (e) => {
console.log('formdata fired');
console.log("formdata fired");

// フォームデータを変更
const formData = e.formData;
formData.set('field1', formData.get('field1').toLowerCase());
formData.set('field2', formData.get('field2').toLowerCase());
formData.set("field1", formData.get("field1").toLowerCase());
formData.set("field2", formData.get("field2").toLowerCase());
};
```

Expand Down
9 changes: 5 additions & 4 deletions files/ja/web/api/htmlformelement/length/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
title: HTMLFormElement.length
title: "HTMLFormElement: length プロパティ"
short-title: length
slug: Web/API/HTMLFormElement/length
l10n:
sourceCommit: 277e5969c63b97cfb55ab4a0e612e8040810f49b
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{APIRef("HTML DOM")}}

**HTMLFormElement.length`** は読み取り専用のプロパティで、 {{HTMLElement("form")}} 要素に含まれるコントロールの数を返します。
**`HTMLFormElement.length`** は読み取り専用のプロパティで、 {{HTMLElement("form")}} 要素に含まれるコントロールの数を返します。

フォームのコントロールの一覧には {{domxref("HTMLFormElement.elements", "elements")}} プロパティを使用してアクセスすることができます。

Expand All @@ -22,7 +23,7 @@ l10n:
##

```js
if (document.getElementById('form1').length > 1) {
if (document.getElementById("form1").length > 1) {
// 複数のフォームコントロールがある場合
}
```
Expand Down
11 changes: 6 additions & 5 deletions files/ja/web/api/htmlformelement/method/index.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
title: HTMLFormElement.method
title: "HTMLFormElement: method プロパティ"
short-title: method
slug: Web/API/HTMLFormElement/method
l10n:
sourceCommit: 277e5969c63b97cfb55ab4a0e612e8040810f49b
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{APIRef("HTML DOM")}}

**`HTMLFormElement.method`** プロパティは、 {{HtmlElement("form")}} を送信するために使用される {{Glossary("HTTP")}} メソッドを表します。
**`HTMLFormElement.method`** プロパティは、{{HtmlElement("form")}} を送信するために使用される {{Glossary("HTTP")}} メソッドを表します。

明示的に指定されない場合、既定のメソッドは 'get' です。
明示的に指定されなかった場合、既定のメソッドは 'get' です。

##

Expand All @@ -18,7 +19,7 @@ l10n:
##

```js
document.forms['myform'].method = 'post';
document.forms["myform"].method = "post";

const formElement = document.createElement("form"); // フォームを生成
document.body.appendChild(formElement);
Expand Down
8 changes: 4 additions & 4 deletions files/ja/web/api/htmlformelement/name/index.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
title: HTMLFormElement.name
title: "HTMLFormElement: name プロパティ"
short-title: name
slug: Web/API/HTMLFormElement/name
l10n:
sourceCommit: 277e5969c63b97cfb55ab4a0e612e8040810f49b
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{APIRef("HTML DOM")}}

**`HTMLFormElement.name`** プロパティは、現在の {{HtmlElement("form")}} 要素の名前を文字列で表します。

{{HTMLElement("Form")}} 要素の中に _name_ という名前の要素があると、その要素は `form.name` プロパティを上書きするので、それにアクセスすることはできません。
Internet Explorer (IE) は `createElement()` を使用して作成された要素の name 属性を `name` プロパティで設定したり変更したりすることを許可していません。

##

Expand All @@ -19,7 +19,7 @@ Internet Explorer (IE) は `createElement()` を使用して作成された要
##

```js
const form1name = document.getElementById('form1').name;
const form1name = document.getElementById("form1").name;

if (form1name !== document.form.form1) {
// ブラウザーがこの形の参照に対応していない
Expand Down
15 changes: 10 additions & 5 deletions files/ja/web/api/htmlformelement/reportvalidity/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
title: HTMLFormElement.reportValidity()
title: "HTMLFormElement: reportValidity() メソッド"
short-title: reportValidity()
slug: Web/API/HTMLFormElement/reportValidity
l10n:
sourceCommit: 8573240024adc1eef906b4b2df35567144fd733e
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{APIRef("HTML DOM")}}
Expand All @@ -24,9 +25,13 @@ reportValidity()
##

```js
document.forms['myform'].addEventListener('submit', () => {
document.forms['myform'].reportValidity();
}, false);
document.forms["myform"].addEventListener(
"submit",
() => {
document.forms["myform"].reportValidity();
},
false
);
```

## 仕様書
Expand Down
13 changes: 9 additions & 4 deletions files/ja/web/api/htmlformelement/requestsubmit/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
title: HTMLFormElement.requestSubmit()
title: "HTMLFormElement: requestSubmit() メソッド"
short-title: requestSubmit()
slug: Web/API/HTMLFormElement/requestSubmit
l10n:
sourceCommit: 8573240024adc1eef906b4b2df35567144fd733e
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{APIRef("HTML DOM")}}
Expand All @@ -20,7 +21,11 @@ requestSubmit(submitter)

- `submitter` {{optional_inline}}

- : フォームを送信するための方法を記述した属性がある送信ボタンです。これは {{HTMLElement("input")}} または {{HTMLElement("button")}} 要素で `type` 属性が `submit` のものです。
- : このフォームのメンバーである{{Glossary("submit button", "送信ボタン")}}です。

`submitter``form*` 属性を指定している場合、このフォームの送信動作を[上書きします](/ja/docs/Glossary/Submit_button#フォームの動作の上書き)`formmethod="POST"` など)。

`submitter``name` 属性があるか`{{HtmlElement('input/image', '&lt;input type="image"&gt;')}}` であった場合、フォームの送信時にそのデータが[含まれます](/ja/docs/Glossary/Submit_button#フォームデータ項目)`btnName=btnValue` など)。

`submitter` 引数を省略した場合、このフォーム要素自身が送信者として使用されます。

Expand All @@ -31,7 +36,7 @@ requestSubmit(submitter)
### 例外

- {{jsxref("TypeError")}}
- : 指定された `submitter` が送信ボタンでない場合に発生します
- : 指定された `submitter` が{{Glossary("submit button", "送信ボタン")}}でなかった場合に発生します
- `NotFoundError` {{domxref("DOMException")}}
- : 指定された `submitter` が、 `requestSubmit()` が呼び出されたフォームのメンバーでない場合に発生します。submitter は form 要素の子孫であるか、フォームを参照する [`form`](/ja/docs/Web/HTML/Element/input#form) 属性を持たなければなりません。

Expand Down
7 changes: 4 additions & 3 deletions files/ja/web/api/htmlformelement/reset/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
title: HTMLFormElement.reset()
title: "HTMLFormElement: reset() メソッド"
short-title: reset()
slug: Web/API/HTMLFormElement/reset
l10n:
sourceCommit: 8573240024adc1eef906b4b2df35567144fd733e
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
---

{{APIRef("HTML DOM")}}
Expand Down Expand Up @@ -30,7 +31,7 @@ reset()
##

```js
document.getElementById('myform').reset();
document.getElementById("myform").reset();
```

## 仕様書
Expand Down
Loading

0 comments on commit f445a0d

Please sign in to comment.