You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2-ui/4-forms-controls/4-forms-submit/article.md
+22-22Lines changed: 22 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,25 @@
1
-
# Forms: event and method submit
1
+
# ফর্মস: ইভেন্ট এবং সাবমিট মেথড
2
2
3
-
The `submit` event triggers when the form is submitted, it is usually used to validate the form before sending it to the server or to abort the submission and process it in JavaScript.
3
+
যখন কোন ফর্ম সাবমিট করা হয় তখন `submit` ইভেন্ট সংগঠিত হয়, সাধারণত সার্ভারে রিকুয়েস্ট সেন্ডের পূর্বে ভ্যালিডেশনের জন্য এটি ব্যবহার করা হয়।
4
4
5
-
The method `form.submit()`allows to initiate form sending from JavaScript. We can use it to dynamically create and send our own forms to server.
5
+
`form.submit()`মেথড এর মাধ্যমে সার্ভারে রিকেয়েস্ট পাঠানো হয়। যখন ডায়নামিক্যালি আমরা ফর্ম তৈরি করি তখন এই মেথডটির সাহায্যে রিকেয়েস্ট পাঠানো হয়।
6
6
7
-
Let's see more details of them.
7
+
চলুন আরো বিস্তারিত জানা যাক।
8
8
9
-
## Event: submit
9
+
## ইভেন্ট: submit
10
10
11
-
There are two main ways to submit a form:
11
+
সাধারণত দুইভাবে আমরা ফর্ম সাবমিট করতে পারি:
12
12
13
-
1.The first -- to click `<input type="submit">`or`<input type="image">`.
14
-
2.The second -- press `key:Enter`on an input field.
13
+
1.প্রথমটি ইনপুট এলিমেন্টের সাহায্যে `<input type="submit">`বা`<input type="image">`।
14
+
2.দ্বিতীয়টি -- কোন ইনপুটে `key:Enter`প্রেসের মাধ্যমে।
15
15
16
-
Both actions lead to `submit`event on the form. The handler can check the data, and if there are errors, show them and call `event.preventDefault()`, then the form won't be sent to the server.
16
+
উভয়ইভাবেই ফর্মের `submit`সংগঠিত হয়। আমরা হ্যান্ডেলারে ডাটা ভ্যালিডেশন করে ডাটা সার্ভারে পাঠাতে পারি, আর যদি কোন এরর থাকে তাহলে তা দেখিয়ে `event.preventDefault()` এর মাধ্যমে সাবমিট থামাতে পারি, ফলে ডাটা ডাটা সার্ভারে যাবে না।
Both actions show`alert`and the form is not sent anywhere due to `return false`:
22
+
উভয়ই ক্ষেত্রে আমরা`alert`দেখব এবং `return false` এর জন্য ডাটা সেন্ড হবে না:
23
23
24
24
```html autorun height=60 no-beautify
25
25
<formonsubmit="alert('submit!');return false">
@@ -28,12 +28,12 @@ Both actions show `alert` and the form is not sent anywhere due to `return false
28
28
</form>
29
29
```
30
30
31
-
````smart header="Relation between `submit`and`click`"
32
-
When a form is sent using `key:Enter`on an input field, a `click` event triggers on the `<input type="submit">`.
31
+
````smart header="`submit`এবং`click` এর মাঝে সম্পর্ক"
32
+
যখন কোন ইনপুট ফিল্ডে `key:Enter`প্রেসের মাধ্যমে ফর্ম সাবমিট করা হয়, তখন `<input type="submit">` এ একটি `click` ইভেন্ট সংগঠিত হয়।
33
33
34
-
That's rather funny, because there was no click at all.
34
+
ব্যাপারটা কেমন বিদঘুটে না? আমরা কোন ক্লিক করিনি তারপরও `click` ইভেন্ট সংগঠিত হয়।
35
35
36
-
Here's the demo:
36
+
এখানে দেখুন:
37
37
```html autorun height=60
38
38
<formonsubmit="return false">
39
39
<inputtype="text"size="30"value="Focus here and press enter">
@@ -43,13 +43,13 @@ Here's the demo:
43
43
44
44
````
45
45
46
-
## Method: submit
46
+
## মেথড: submit
47
47
48
-
To submit a form to the server manually, we can call `form.submit()`.
48
+
ম্যানুয়ালি একটি ফর্ম সাবমিটের জন্য আমরা `form.submit()` ব্যবহার করি।
49
49
50
-
Then the `submit` event is not generated. It is assumed that if the programmer calls `form.submit()`, then the script already did all related processing.
50
+
তখন `submit` ইভেন্টটি সংগঠিত হয় না। কেননা `form.submit()` কল করা প্রোগ্রামের মাধ্যমে, সুতরাং আমরা ধরে নিতে পারি ডেভলাপার সকল ভ্যালিডেশন করার পর এই মেথডটি কল করছে।
51
51
52
-
Sometimes that's used to manually create and send a form, like this:
52
+
অনেক সময় স্ক্রিপ্টের মাধ্যমে ফর্ম তৈরি করে তা সাবমিটের জন্য আমরা এটি ব্যবহার করি, নিচে একটি উদাহরণ দেয়া হল:
53
53
54
54
```js run
55
55
let form = document.createElement('form');
@@ -58,7 +58,7 @@ form.method = 'GET';
58
58
59
59
form.innerHTML = '<input name="q" value="test">';
60
60
61
-
// the form must be in the document to submit it
61
+
// ফর্মটি সাবমিট করার জন্য অবশ্যই এটি ডকুমেন্টের নোড হতে হবে
0 commit comments