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/1-modal-dialog/solution.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
A modal window can be implemented using a half-transparent `<div id="cover-div">`that covers the whole window, like this:
1
+
Una finestra modale può essere implementata usando un `<div id="cover-div">`semitrasparente che copre l'intera finestra, in questa maniera:
2
2
3
3
```css
4
4
#cover-div {
@@ -13,8 +13,8 @@ A modal window can be implemented using a half-transparent `<div id="cover-div">
13
13
}
14
14
```
15
15
16
-
Because the `<div>`covers everything, it gets all clicks, not the page below it.
16
+
Dato che il `<div>`copre ogni cosa, sarà questo elemento a catturare tutti i click, e non la pagina sottostante.
17
17
18
-
Also we can prevent page scroll by setting`body.style.overflowY='hidden'`.
18
+
Inoltre può essere prevenuto lo scrolling della pagina impostando`body.style.overflowY='hidden'`.
19
19
20
-
The form should be not in the`<div>`, but next to it, because we don't want it to have`opacity`.
20
+
Il form non dovrebbe essere dentro il`<div>`, ma subito dopo nel codice della pagina (quindi starà anche sopra), perché non vogliamo che sia soggetto alla trasparenza dovuta ad`opacity`.
Copy file name to clipboardExpand all lines: 2-ui/4-forms-controls/4-forms-submit/1-modal-dialog/task.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,30 +4,30 @@ importance: 5
4
4
5
5
# Modal form
6
6
7
-
Create a function`showPrompt(html, callback)`that shows a form with the message`html`, an input field and buttons`OK/CANCEL`.
7
+
Creare una funzione`showPrompt(html, callback)`che mostra un form con un messaggio`html`, un campo di input ed i pulsanti`OK/CANCEL`.
8
8
9
-
-A user should type something into a text field and press`key:Enter`or the OK button, then `callback(value)`is called with the value they entered.
10
-
-Otherwise if the user presses `key:Esc`or CANCEL, then `callback(null)` is called.
9
+
-Un utente dovrebbe digitare qualcosa nel campo di testo e premere`key:Enter`o il pulsante OK, quindi verrà chiamata `callback(value)`con il valore che è stato inserito.
10
+
-Altrimenti, se l'utente preme `key:Esc`oppure CANCEL, viene chiamata `callback(null)`.
11
11
12
-
In both cases that ends the input process and removes the form.
12
+
In entrambi i casi, questo termina l'elaborazione dell'input e rimuove il form.
13
13
14
-
Requirements:
14
+
Requisiti:
15
15
16
-
-The form should be in the center of the window.
17
-
-The form is*modal*. In other words, no interaction with the rest of the page is possible until the user closes it.
18
-
-When the form is shown, the focus should be inside the `<input>`for the user.
19
-
-Keys `key:Tab`/`key:Shift+Tab`should shift the focus between form fields, don't allow it to leave for other page elements.
16
+
-Il form dovrebbe essere al centro della finestra.
17
+
-Il form è*modal*. In altre parole, non possono esserci interazioni con il resto della pagina fino a quando non viene chiusa.
18
+
-Quando viene mostrato il form, il focus dovrebbe essere dentro il campo `<input>`per l'utente.
19
+
-I tasti `key:Tab`/`key:Shift+Tab`dovrebbe cambiare il focus tra i campi del form, e non permettergli di lasciarlo per altri elementi della pagina.
Copy file name to clipboardExpand all lines: 2-ui/4-forms-controls/4-forms-submit/article.md
+24-24Lines changed: 24 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,55 +1,55 @@
1
-
# Forms: event and method submit
1
+
# Form: eventi e metodi di submit
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
+
L'evento`submit`si scatena quando il form viene inviato, e solitamente viene usato per validare il form prima dell'invio al server o per annullare l'invio e elaborarlo con JavaScript.
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
+
Il metodo`form.submit()`ci permette di iniziare l'invio del form da JavaScript. Possiamo usarlo per creare ed inviare i nostri form al server dinamicamente.
6
6
7
-
Let's see more details of them.
7
+
Andiamo più nel dettaglio.
8
8
9
-
## Event: submit
9
+
## Evento: submit
10
10
11
-
There are two main ways to submit a form:
11
+
Ci sono due modi per inviare un form:
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.Il primo -- cliccare `<input type="submit">`o`<input type="image">`.
14
+
2.Il secondo -- premere`key:Enter`su un campo di input.
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
+
Entrambe le azioni portano all'evento `submit`del form. Il gestore può controllare i dati, ed in caso di errori, può mostrarli e chiamare`event.preventDefault()`, ed a quel punto il form non viene inviato al server.
17
17
18
-
In the form below:
19
-
1.Go into the text field and press`key:Enter`.
20
-
2.Click`<input type="submit">`.
18
+
Nel form seguente:
19
+
1.Andare nel campo di testo e premere`key:Enter`.
20
+
2.Cliccare`<input type="submit">`.
21
21
22
-
Both actions show `alert`and the form is not sent anywhere due to`return false`:
22
+
Entrambe le azioni mostrano un `alert`ed il form non viene inviato da nessuna parte a causa di`return false`:
23
23
24
24
```html autorun height=60 no-beautify
25
25
<formonsubmit="alert('submit!');return false">
26
-
First: Enter in the input field <inputtype="text"value="text"><br>
To submit a form to the server manually, we can call `form.submit()`.
48
+
Per eseguire l'invio (submit) di un form sul server manualmente, possiamo chiamare `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
+
In questo caso l'evento di `submit` non viene generato. Si assume che il programmatore chiamando `form.submit()`, abbia previsto che nello script siano state considerate tutte le dovute elaborazioni.
51
51
52
-
Sometimes that's used to manually create and send a form, like this:
52
+
Talvolta viene usato per creare ed inviare manualmente un form, come in questo esempio:
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
+
// il form deve essere nel documento per poterlo inviare
0 commit comments