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
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 ventana modal puede ser implementada utilizando un `<div id="cover-div">`semi-transparente que cubra completamente la ventana, como a continuación:
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
+
Debido a que el `<div>`cubre toda la ventana, recibe todos los clicks, en vez de la página tras él.
17
17
18
-
Also we can prevent page scroll by setting`body.style.overflowY='hidden'`.
18
+
También podemos evitar el scroll en la página utilizando`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
+
El formulario no debe estar en el`<div>` sino junto a él, porque no queremos que tenga`opacity`.
Copy file name to clipboardExpand all lines: 2-ui/4-forms-controls/4-forms-submit/1-modal-dialog/task.md
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -2,32 +2,32 @@ importance: 5
2
2
3
3
---
4
4
5
-
# Modal form
5
+
# Formulario modal
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
+
Crea una función`showPrompt(html, callback)` que muestre un formulario con el mensaje `html`, un campo input y botones `OK/CANCELAR`.
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 usuario debe escribir algo en el campo de texto y pulsar `key:Enter`o el botón OK, entonces`callback(value)`es llamado con el valor introducido.
10
+
-En caso contrario, si el usuario pulsa `key:Esc`o CANCELAR, entonces`callback(null)`es llamado.
11
11
12
-
In both cases that ends the input process and removes the form.
12
+
En ambos casos se finaliza el proceso se y borra el formulario.
13
13
14
-
Requirements:
14
+
Requisitos:
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
+
-El formulario debe estar en el centro de la ventana.
17
+
-El formulario es*modal*. Es decir que no habrá interacción con el resto de la página, siempre que sea posible, hasta que el usuario lo cierre.
18
+
-Cuando se muestra el formulario, el foco debe estar en el`<input>`del usuario.
19
+
-Las teclas `key:Tab`/`key:Shift+Tab`deben alternar el foco entre los diferentes campos del formulario, no se permite cambiar el foco a otros elementos de la página.
Copy file name to clipboardExpand all lines: 2-ui/4-forms-controls/4-forms-submit/article.md
+24-24Lines changed: 24 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -1,55 +1,55 @@
1
-
# Forms: event and method submit
1
+
# Formularios: evento y método 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
+
El evento `submit`se activa cuando el formlario es enviado, normalmente se utiliza para validar el formulario antes de ser enviado al servidor o bien para abortar el envío y procesarlo 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
+
El método`form.submit()`permite iniciar el envío del formulario mediante JavaScript. Podemos utilizarlo para crear y enviar nuestros propios formularios al servidor.
6
6
7
-
Let's see more details of them.
7
+
Veamos más detalles sobre ellos.
8
8
9
-
## Event: submit
9
+
## Evento: submit
10
10
11
-
There are two main ways to submit a form:
11
+
Mayormente un formulario puede enviarse de dos maneras:
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.La primera -- Haciendo click en `<input type="submit">`o en`<input type="image">`.
14
+
2.La segunda -- Pulsando la tecla `key:Enter`en un campo del formulario.
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
+
Ambas acciones causan que el evento `submit`sea activado en el formulario. El handler puede comprobar los datos, y si hay errores, mostrarlos e invocar `event.preventDefault()`, entonces el formulario no será enviado al servidor.
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
+
En el formulario de abajo:
19
+
1.Ve al campo tipo texto y pulsa la tecla`key:Enter`.
20
+
2.Haz click en`<input type="submit">`.
21
21
22
-
Both actions show`alert`and the form is not sent anywhere due to`return false`:
22
+
Ambas acciones muestran`alert`y el formulario no es enviado debido a la presencia de`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
+
Para enviar un formulario al servidor manualmente, podemos usar `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
+
Entonces el evento `submit` no será generado. Se asume que si el programador llama `form.submit()`, entonces el script ya realizó todo el procesamiento relacionado.
51
51
52
-
Sometimes that's used to manually create and send a form, like this:
52
+
A veces es usado para crear y enviar un formlario manualmente, como en este ejemplo:
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
+
// el formulario debe estar en el document para poder enviarlo
0 commit comments