Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1a2d66d

Browse files
authored
Form properties and methods
Form properties and methods
2 parents 1ba271c + 6fa86e6 commit 1a2d66d

File tree

1 file changed

+115
-105
lines changed

1 file changed

+115
-105
lines changed
Lines changed: 115 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,66 @@
1-
# Form properties and methods
1+
# Form özellikleri ve metodları
22

3-
Forms and control elements, such as `<input>` have a lot of special properties and events.
3+
Formlar ve kontrol elemanları, `<input>` gibi, birçok özel işleme ve özelliklere sahiptir.
44

5-
Working with forms will be much more convenient when we learn them.
5+
Fromları öğrendiğimizde, onlarla çalışmak çok daha kolay olacak.
66

7-
## Navigation: form and elements
7+
## Navigasyon: form and elemanlar
88

9-
Document forms are members of the special collection `document.forms`.
9+
Form dökümanları özel bir dizi olan `document.forms` üyleridir.
1010

11-
That's a so-called "named collection": it's both named and ordered. We can use both the name or the number in the document to get the form.
11+
Bu, bir "adlandırılmış koleksiyon" olarak adlandırılan bir durumdur: hem isimlendirilmiş hem de sıralanmıştır. Belgede forma ulaşmak için hem adı hem de numarasını kullanabiliriz.
1212

1313
```js no-beautify
14-
document.forms.my- the form with name="my"
15-
document.forms[0]- the first form in the document
14+
document.forms.my; //"my" isimli form
15+
document.forms[0]; // döküman içindeki ilk form
1616
```
1717

18-
When we have a form, then any element is available in the named collection `form.elements`.
18+
Yeni bir form oluşturulduğunda içerisindeki bütün elemanlar `form.elements` isimli adlandırılmış koleksiyonda erişilebilir haldedir.
1919

20-
For instance:
20+
Örneğin:
2121

2222
```html run height=40
2323
<form name="my">
24-
<input name="one" value="1">
25-
<input name="two" value="2">
24+
<input name="one" value="1" />
25+
<input name="two" value="2" />
2626
</form>
2727

2828
<script>
29-
// get the form
30-
let form = document.forms.my; // <form name="my"> element
29+
// forma ulaşmak için
30+
let form = document.forms.my; // <form name="my"> form elemanı
3131
32-
// get the element
33-
let elem = form.elements.one; // <input name="one"> element
32+
// form elemanına ulaşmak için
33+
let elem = form.elements.one; // <input name="one"> input elemanı
3434
3535
alert(elem.value); // 1
3636
</script>
3737
```
3838

39-
There may be multiple elements with the same name, that's often the case with radio buttons.
39+
Formlarda aynı isme sahip birden fazla eleman olabilir. Böyle bir durumla daha çok radyo tipindeki input elemanlarında karşılaşırız.
4040

41-
In that case `form.elements[name]` is a collection, for instance:
41+
Bu durumda `form.elements[name]` bir koleksiyondur, örneğin:
4242

4343
```html run height=40
4444
<form>
45-
<input type="radio" *!*name="age"*/!* value="10">
46-
<inputtype="radio"*!*name="age"*/!* value="20">
45+
<input type="radio" *!*name="age"*/!* value="10"> <input
46+
type="radio"*!*name="age"*/!* value="20">
4747
</form>
4848

4949
<script>
50-
let form = document.forms[0];
50+
let form = document.forms[0];
5151
52-
let ageElems = form.elements.age;
52+
let ageElems = form.elements.age;
5353
54-
alert(ageElems[0].value); // 10, the first input value
54+
alert(ageElems[0].value); // 10, ilk input değeri
5555
</script>
5656
```
5757

58-
These navigation properties do not depend on the tag structure. All elements, no matter how deep they are in the form, are available in `form.elements`.
58+
Bu navigasyon özellikleri etiket yapılarına bağlı değildir. Bütün elemanlar, formun neresinde olursa olsun, `form.elements` koleksiyonu içerisinde bulunur.
5959

60+
````smart header=""Alt formlar" olarak alan kümeleri"
61+
Bir form bir veya birden fazla `<fieldset>` elemanına sahip olabilir. Bunlar ayrıca `elements` özelliklerine sahiptirler.
6062
61-
````smart header="Fieldsets as \"subforms\""
62-
A form may have one or many `<fieldset>` elements inside it. They also support the `elements` property.
63-
64-
For instance:
63+
Örneğin:
6564
6665
```html run height=80
6766
<body>
@@ -79,58 +78,59 @@ For instance:
7978
let fieldset = form.elements.userFields;
8079
alert(fieldset); // HTMLFieldSetElement
8180
82-
// we can get the input both from the form and from the fieldset
83-
alert(fieldset.elements.login == form.elements.login); // true
81+
// input elemanına hem form hemde fieldset kullanarak ulaşabiliriz.
82+
alert(fieldset.elements.login == form.elements.login); // doğru
8483
*/!*
8584
</script>
8685
</body>
8786
```
8887
````
8988

90-
````warn header="Shorter notation: `form.name`"
91-
There's a shorter notation: we can access the element as `form[index/name]`.
89+
````warn header="Kısa gösterimi: `form.name`"
90+
Daha kısa bir gösterim mevcut: `form[index/name]` ile bu elamana ulaşabiliriz.
9291

93-
Instead of `form.elements.login` we can write `form.login`.
92+
`form.elements.login` yerine `form.login` yazabiliriz.
9493

95-
That also works, but there's a minor issue: if we access an element, and then change its `name`, then it is still available under the old name (as well as under the new one).
94+
Bu da çalışır fakat, burada ufak bir problem var:eğer bir elamana erişirsek ve daha sonra ismini(`name`) değiştirirsek bu eleman eski ismiyle hala erişilebilir durumdadır.(aynı zamanda yeni ismiylede erişeliebilir).
9695

97-
That's easy to see in an example:
96+
Aşağıdaki örnekte bunu kolaylıkla görebiliriz:
9897

9998
```html run height=40
10099
<form id="form">
101-
<input name="login">
100+
<input name="login" />
102101
</form>
103102

104103
<script>
105-
alert(form.elements.login == form.login); // true, the same <input>
104+
alert(form.elements.login == form.login); // doğru, aynı <input>
106105
107-
form.login.name = "username"; // change the name of the input
106+
form.login.name = "username"; // input'un ismini değiştir
108107
109-
// form.elements updated the name:
110-
alert(form.elements.login); // undefined
111-
alert(form.elements.username); // input
108+
// form.elements isim etiketini güncelledi:
109+
alert(form.elements.login); // tanımsız
110+
alert(form.elements.username); // input
112111
113-
*!*
114-
// the direct access now can use both names: the new one and the old one
115-
alert(form.username == form.login); // true
116-
*/!*
112+
*!*
113+
// doğrudan erişim için iki isimde kullanılabilir: yeni isim ve eski isim
114+
alert(form.username == form.login); // doğru
115+
*/!*
117116
</script>
118117
```
119118

120-
That's usually not a problem, because we rarely change names of form elements.
119+
Bu durum genelde bir sorun oluşturmaz çünkü, form elemanların ismini hemen hemen hiç değiştirmeyiz.
121120

122121
````
123122
124-
## Backreference: element.form
123+
## Geriye referans: element.form
124+
125125
126-
For any element, the form is available as `element.form`. So a form references all elements, and elements
127-
reference the form.
126+
Herhangi bir eleman için form, `element.form` olarak erişilebilir. Bu sayede bir form, tüm elemanlara referans eder ve elemanlar da forma referans eder.
128127
129-
Here's the picture:
128+
129+
Konuyu görselleştirmek için bir resim:
130130
131131
![](form-navigation.svg)
132132
133-
For instance:
133+
Örneğin:
134134
135135
```html run height=40
136136
<form id="form">
@@ -139,53 +139,58 @@ For instance:
139139
140140
<script>
141141
*!*
142-
// form -> element
142+
// form -> eleman
143143
let login = form.login;
144144
145-
// element -> form
145+
// eleman -> form
146146
alert(login.form); // HTMLFormElement
147147
*/!*
148148
</script>
149149
```
150150
151-
## Form elements
151+
## Form elemanları
152+
153+
Birazda form kontrol elemanlarından bahsedelim, özelliklerine dikkat etmelisin.
152154
153-
Let's talk about form controls, pay attention to their specific features.
155+
### input ve textarea
154156
155-
### input and textarea
157+
Tipi checkbox olan elemanların değerlerine `input.value` (metin tipinde) veya `input.checked` (mantıksal tipde) ulaşılabilir.
156158
157-
We can access their value as `input.value` (string) or `input.checked` (boolean) for checkboxes.
158159
159-
Like this:
160+
Bunun gibi:
160161
161162
```js
162-
input.value = "New value";
163-
textarea.value = "New text";
163+
input.value = "Yeni değer";
164+
textarea.value = "Yeni metin";
164165
165-
input.checked = true; // for a checkbox or radio button
166+
input.checked = true; // checkbox veya radio button tipleri için
166167
```
167168
168-
```warn header="Use `textarea.value`, not `textarea.innerHTML`"
169-
Please note that even though `<textarea>...</textarea>` holds its value as nested HTML, we should never use `textarea.innerHTML`. It stores only the HTML that was initially on the page, not the current value.
169+
```warn header=" `textarea.innerHTML` yerine `textarea.value` kullanmalısın"
170+
171+
Lütfen şunu unutma, <textarea>...</textarea> içeriğini iç içe geçmiş HTML olarak saklasa da, asla textarea.innerHTML kullanmamalıyız. Bu sadece sayfa ilk yüklendiğinde olan HTML'i saklar, mevcut değeri değil.
172+
170173
```
171174
172-
### select and option
175+
### select ve option
173176
174-
A `<select>` element has 3 important properties:
177+
A `<select>` 3 önemli özelliği vardır:
175178
176-
1. `select.options` -- the collection of `<option>` elements,
177-
2. `select.value` -- the value of the currently selected option,
178-
3. `select.selectedIndex` -- the number of the currently selected option.
179+
1. `select.options` -- `<option>` elemanlarından oluşan bir dizi,
180+
2. `select.value` -- halihazırda seçilmiş olan seçeneğin değeri,
181+
3. `select.selectedIndex` -- halihazırda seçilmiş olan seçeneğin dizin numarası.
179182
180-
So we have three ways to set the value of a `<select>`:
183+
`<select>` elemanınına değer atamak için üç farklı yol mevcut:
181184
182-
1. Find the needed `<option>` and set `option.selected` to `true`.
183-
2. Set `select.value` to the value.
184-
3. Set `select.selectedIndex` to the number of the option.
185185
186-
The first way is the most obvious, but `(2)` and `(3)` are usually more convenient.
186+
1. Gerekli olan `<option>` seçeneğini bul ve `option.selected` değerini `true` olarak ayarla.
187+
2. `select.value` değerine değişken değeri ata.
188+
3. `select.selectedIndex` değerine, seçeneğin dizin numarasını yaz.
187189
188-
Here is an example:
190+
İlk seçenek en bariz olan fakat `(2)` ve `(3)` daha uygun.
191+
192+
193+
İşte bir örnek:
189194
190195
```html run
191196
<select id="select">
@@ -195,16 +200,16 @@ Here is an example:
195200
</select>
196201
197202
<script>
198-
// all three lines do the same thing
203+
// üç satırda aynı işi yapıyor
199204
select.options[2].selected = true;
200205
select.selectedIndex = 2;
201206
select.value = 'banana';
202207
</script>
203208
```
204209
205-
Unlike most other controls, `<select multiple>` allows multiple choice. In that case we need to walk over `select.options` to get all selected values.
210+
Diğer çoğu kontrolün aksine, <select multiple> çoklu seçime izin verir. Bu durumda, tüm seçilmiş değerlere ulaşmak için `select.options` üzerinde dizi metodları ile işlem yapmamız gerekir.
206211
207-
Like this:
212+
Şu şekilde:
208213
209214
```html run
210215
<select id="select" *!*multiple*/!*>
@@ -214,75 +219,80 @@ Like this:
214219
</select>
215220
216221
<script>
217-
// get all selected values from multi-select
222+
// multi-select ile seçilmiş bütün seçeknelere ulaşma
218223
let selected = Array.from(select.options)
219224
.filter(option => option.selected)
220225
.map(option => option.value);
221226
222-
alert(selected); // blues,rock
227+
alert(selected); // blues,rock
223228
</script>
224229
```
230+
Daha detaylı bilgi edinmek için: <https://html.spec.whatwg.org/multipage/forms.html#the-select-element> sayfasını ziyaret edin.
225231
226-
The full specification of the `<select>` element is available in the specification <https://html.spec.whatwg.org/multipage/forms.html#the-select-element>.
227232
228-
### new Option
233+
### new Option (yeni Seçenek)
229234
230-
This is rarely used on its own. But there's still an interesting thing.
235+
Bu yöntem çoğu zaman tek başına kullanılmaz fakat bahsedilmesi gereken bir durum var.
231236
232-
In the specification of [the option element](https://html.spec.whatwg.org/multipage/forms.html#the-option-element) there's a nice short syntax to create `<option>` elements:
237+
[Seçenek elemanı](https://html.spec.whatwg.org/multipage/forms.html#the-option-element) dökümantasyonunda `<option>` oluşturmak için kısa ve hoş bir notasyon mevcut:
233238
234239
```js
235240
option = new Option(text, value, defaultSelected, selected);
236241
```
237242
238-
Parameters:
243+
Değişkenler:
239244
240-
- `text` -- the text inside the option,
241-
- `value` -- the option value,
242-
- `defaultSelected` -- if `true`, then `selected` HTML-attribute is created,
243-
- `selected` -- if `true`, then the option is selected.
245+
- `text` -- seçenek içindeki metin,
246+
- `value` -- seçeneğin değeri,
247+
- `defaultSelected` -- eğer `true`, ise `selected` HTML-attribute oluşturulur,
248+
- `selected` -- eğer `true`, ise, seçenek işaretlenir.
244249
245-
For instance:
250+
Örneğin:
246251
247252
```js
248253
let option = new Option("Text", "value");
249-
// creates <option value="value">Text</option>
254+
// <option value="value">Text</option> oluşturur
250255
```
251256
252-
The same element selected:
257+
Aynı eleman seçildi:
253258
254259
```js
255260
let option = new Option("Text", "value", true, true);
256261
```
257262
258-
```smart header="Additional properties of `<option>`"
259-
Option elements have additional properties:
263+
```smart header="`<option>` ek özellikleri"
264+
Seçenek elemanlarının ek özellikleri vardır:
260265
261266
`selected`
262-
: Is the option selected.
267+
: seçenek seçildi mi.
263268
264269
`index`
265-
: The number of the option among the others in its `<select>`.
270+
: `<select>` seçeneklerinin dizin numarası.
266271
267272
`text`
268-
: Text content of the option (seen by the visitor).
273+
: Seçenekte belirtilen metin (kullanıcı tarafından görülür).
269274
```
270275
271-
## Summary
276+
## Özet
272277
273-
Form navigation:
278+
From navigasyonu:
274279
275280
`document.forms`
276-
: A form is available as `document.forms[name/index]`.
281+
: Form `document.forms[name/index]` olarak mevcuttur..
277282
278-
`form.elements`
279-
: Form elements are available as `form.elements[name/index]`, or can use just `form[name/index]`. The `elements` property also works for `<fieldset>`.
283+
`form.elements`
284+
: Form elemanlarına `form.elements[name/index]` kullanarak ulaşılabilir yada or `form[name/index]` kullanılarak ulaşılabilir. `elements` özelliği `<fieldset>` için de çalışır.
280285
281286
`element.form`
282-
: Elements reference their form in the `form` property.
283287
284-
Value is available as `input.value`, `textarea.value`, `select.value` etc, or `input.checked` for checkboxes and radio buttons.
285288
286-
For `<select>` we can also get the value by the index `select.selectedIndex` or through the options collection `select.options`. The full specification of this and other elements is in the specification <https://html.spec.whatwg.org/multipage/forms.html>.
289+
:Elemanlar, form özelliğinde kendi `form`larına referans yaparlar.
290+
291+
Değerlere `input.value`, `textarea.value`, `select.value` v.b., yada `input.checked` kullanarak checkbox ve radio buttons tipindeki input'lar için ulaşılabilir.
292+
287293
288-
These are the basics to start working with forms. We'll meet many examples further in the tutorial. In the next chapter we'll cover `focus` and `blur` events that may occur on any element, but are mostly handled on forms.
294+
295+
<select> için değeri ayrıca dizin numarasıyla select.selectedIndex veya seçenekler diziu select.options üzerinden alabiliriz. Bu ve diğer öğelerin tam belgesi belgede bulunabilir <https://html.spec.whatwg.org/multipage/forms.html>.
296+
297+
Bu bilgiler formlar ile çalışmak için temel bilgiler.Eğitimin ilerleyen bölümlerinde birçok örnekle karşılaşacağız. Bir sonraki bölümde, herhangi bir öğe üzerinde oluşabilecek, ancak çoğunlukla formlar üzerinde işlenen `focus` ve `blur` olaylarını ele alacağız.
298+
````

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /