1 | <!DOCTYPE html> |
2 | <html lang="es"> |
3 | |
4 | <head> |
5 | |
6 | <meta charset="UTF-8"> |
7 | <meta name="viewport" |
8 | content="width=device-width"> |
9 | |
10 | <title>Modificar</title> |
11 | |
12 | <script type="module" src="lib/js/invocaServicio.js"></script> |
13 | <script type="module" src="lib/js/submitForm.js"></script> |
14 | <script type="module" src="lib/js/muestraObjeto.js"></script> |
15 | <script type="module" src="lib/js/muestraError.js"></script> |
16 | <script type="module" src="lib/js/confirmaEliminar.js"></script> |
17 | |
18 | <script> |
19 | |
20 | const params = new URL(location.href).searchParams |
21 | </script> |
22 | |
23 | </head> |
24 | |
25 | <body onload="if (params.size > 0) { |
26 | invocaServicio('srv/srvPasatiempoBusca.php?' + params) |
27 | .then(modelo => muestraObjeto(forma, modelo.body)) |
28 | .catch(muestraError) |
29 | }"> |
30 | |
31 | <form id="forma" onsubmit="submitForm('srv/srvPasatiempoModifica.php', event) |
32 | .then(modelo => location.href = 'index.html') |
33 | .catch(muestraError)"> |
34 | |
35 | <h1>Modificar</h1> |
36 | |
37 | <p><a href="index.html">Cancelar</a></p> |
38 | |
39 | <input name="id" type="hidden"> |
40 | |
41 | <p> |
42 | <label> |
43 | Nombre * |
44 | <input name="nombre" value="Cargando…"> |
45 | </label> |
46 | </p> |
47 | |
48 | <p>* Obligatorio</p> |
49 | |
50 | <p> |
51 | |
52 | <button type="submit">Guardar</button> |
53 | |
54 | <button type="button" onclick="if (params.size > 0 && confirmaEliminar()) { |
55 | invocaServicio('srv/srvPasatiempoElimina.php?' + params) |
56 | .then(() => location.href = 'index.html') |
57 | .catch(muestraError) |
58 | }"> |
59 | Eliminar |
60 | </button> |
61 | |
62 | </p> |
63 | |
64 | </form> |
65 | |
66 | </body> |
67 | |
68 | </html> |