formulario.jsp 7.08 KB
Newer Older
1
<%@ page language="java" contentType="text/html; charset=UTF-8"
2
pageEncoding="UTF-8"%>
3
    <%@ page import="java.sql.*,java.sql.Connection,java.sql.ResultSet,com.roshka.proyectofinal.DataBase,jakarta.servlet.http.HttpServlet,jakarta.servlet.http.HttpServletRequest"%>
4 5


6
        <head>
Yovan Martinez committed
7 8 9 10
            <link href="estilos/form.css" rel="stylesheet" type="text/css" />
            <link rel="shortcut icon" href="imagenes/roshkaicon.ico" sizes="any" />
            <!-- CSS only -->
            <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
11
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Yovan Martinez committed
12
            <link rel="stylesheet" href="form.css" type="text/css">
13 14 15
            <link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
            <script src="Javascript.js"></script>
            <link rel="stylesheet" media="(max-width: 800px)" href="example.css" />
Yovan Martinez committed
16
            <title>Formulario Postulante</title>
17 18 19 20 21 22 23 24 25 26 27
        </head>

        <body>
            <header>
                <div class="logo">
                    <img src="imagenes/logo-roshka.svg" alt="log-roshka" />
                </div>
            </header>
            <main class="create">
                <article class="contenedor">
                    <div>
Yovan Martinez committed
28
                        <%
29 30 31 32 33 34 35
                        int id =Integer.parseInt(request.getParameter("bootcamp"));
                        Connection con = DataBase.getConnection();
                        Statement stmt = con.createStatement();
                        ResultSet rs = stmt.executeQuery("SELECT * FROM bootcamp WHERE id= "+id+ " LIMIT 1" );
                        rs.next();
                    %>

Yovan Martinez committed
36 37 38 39 40
                            <h2>Descripcion:</h2>
                            <p>
                                <%= rs.getString("descripcion") %>
                            </p>
                            <p class="enter">Si sigues interesado y cumples con los requisitos, completa el siguiente formulario: </p>
41

42
                            <form method="get" action="SaveServlet" class="form">
43

Yovan Martinez committed
44
                                <input type="hidden" name="bootcamp" value="<%= request.getParameter(" bootcamp ") %>">
45

Yovan Martinez committed
46 47
                                <label for="nombre">Ingrese su Nombre:</label>
                                <input required id="nombre" name="nombre" type="text"><br>
48

Yovan Martinez committed
49 50
                                <label for="apellido">Ingrese su Apellido:</label>
                                <input required id="apellido" name="apellido" type="text"><br>
51

Yovan Martinez committed
52 53
                                <label for="cedula">Numero de cedula:</label>
                                <input required id="cedula" name="cedula" type="number"><br>
54

Yovan Martinez committed
55 56
                                <label for="correo">Correo:</label>
                                <input required id="correo" name="correo" type="email"><br>
57

Yovan Martinez committed
58 59
                                <label for="telefono">Telefono:</label>
                                <input required id="telefono" name="telefono" type="text"><br>
60

Yovan Martinez committed
61 62
                                <label for="direccion">Direccion:</label>
                                <input required id="direccion" name="direccion" type="text"><br>
63

Yovan Martinez committed
64 65 66
                                <label for="experiencia_laboral">Experiencia laboral</label>
                                <!-- Si no lo marca el valor que envia es null y si lo marca es "ON" -->
                                <input id="experiencia_laboral" name="experiencia_laboral" type="checkbox"><br>
67

68

Yovan Martinez committed
69 70
                                <label for="notebook">Cuenta con notebook</label>
                                <input id="notebook" name="notebook" type="checkbox"><br>
71

Yovan Martinez committed
72 73 74 75
                                <label for="universidad">Estudio Universitario </label>
                                <input id="universidad" name="universidad" type="checkbox"><br>

                                <p for="experiencia_programando">Lenguajes de programacion que conoces:</p>
Yovan Martinez committed
76

Yovan Martinez committed
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
                                <%@ page import="com.roshka.proyectofinal.entity.Lenguaje, com.roshka.proyectofinal.lenguaje.LenguajeDao, java.util.List,java.util.Iterator" %>
                                    <%
                                    LenguajeDao lenDao = new LenguajeDao();
                                    List<Lenguaje> listLenguaje = lenDao.listar();
                                    Iterator<Lenguaje> iter =  listLenguaje.iterator();
                                                Lenguaje len = null;
                                    %>
                                        <ul id="agarraunolaputa">
                                            <% while(iter.hasNext()){
                                        len = iter.next();
                                    %>
                                                <li class="d-flex">
                                                    <label for=<%=len.getNombre_lenguaje() %> > <%= len.getNombre_lenguaje() %> </label>
                                                    <input onclick="enviar(id)" value=<%=len.getId() %> id=
                                                    <%=len.getNombre_lenguaje() %> name=
                                                        <%=len.getNombre_lenguaje() %> type="checkbox" >
                                                </li>
                                                <% } %>
                                        </ul>
                                        <input class="enviar info error" type="submit">
                                        <input class="borrar" type="reset" value="Borrar"><br>
                                        <a href="index.html">volver</a>
                            </form>
Yovan Martinez committed
100
                    </div>
101 102 103
                </article>
            </main>
        </body>
Yovan Martinez committed
104

105 106 107 108 109 110 111
        </html>
        <script>
            (function() {
                const form = document.querySelector('#agarraunolaputa');
                const checkboxes = form.querySelectorAll('input[type=checkbox]');
                const checkboxLength = checkboxes.length;
                const firstCheckbox = checkboxLength > 0 ? checkboxes[0] : null;
112

113 114 115 116 117 118 119
                function init() {
                    if (firstCheckbox) {
                        for (let i = 0; i < checkboxLength; i++) {
                            checkboxes[i].addEventListener('change', checkValidity);
                        }

                        checkValidity();
120
                    }
121
                }
122

123 124 125 126 127
                function isChecked() {
                    for (let i = 0; i < checkboxLength; i++) {
                        if (checkboxes[i].checked) return true;
                    }
                    return false;
128 129
                }

130 131 132
                function checkValidity() {
                    const errorMessage = !isChecked() ? 'Debe seleccionar al menos un lenguaje que conozca' : '';
                    firstCheckbox.setCustomValidity(errorMessage);
133
                }
134 135
                init();
            })();
136
        </script>