formulario.jsp 7.09 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
        <!DOCTYPE html>
        <html>
7

8
        <head>
Yovan Martinez committed
9 10 11 12
            <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">
13
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Yovan Martinez committed
14
            <link rel="stylesheet" href="form.css" type="text/css">
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
            <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" />
            <title>Formulario Postulante</title>

        </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
31
                        <%
32 33 34 35 36 37 38
                        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
39 40 41 42 43
                            <h2>Descripcion:</h2>
                            <p>
                                <%= rs.getString("descripcion") %>
                            </p>
                            <p class="enter">Si sigues interesado y cumples con los requisitos, completa el siguiente formulario: </p>
44

Yovan Martinez committed
45
                            <form method="post" action="SaveServlet" class="form">
46 47


Yovan Martinez committed
48
                                <input type="hidden" name="bootcamp_id" value="<%= request.getParameter("bootcamp") %>">
49

Yovan Martinez committed
50 51
                                <label for="nombre">Ingrese su Nombre:</label>
                                <input required id="nombre" name="nombre" type="text"><br>
52

Yovan Martinez committed
53 54
                                <label for="apellido">Ingrese su Apellido:</label>
                                <input required id="apellido" name="apellido" type="text"><br>
55

Yovan Martinez committed
56 57
                                <label for="cedula">Numero de cedula:</label>
                                <input required id="cedula" name="cedula" type="number"><br>
58

Yovan Martinez committed
59 60
                                <label for="correo">Correo:</label>
                                <input required id="correo" name="correo" type="email"><br>
61

Yovan Martinez committed
62 63
                                <label for="telefono">Telefono:</label>
                                <input required id="telefono" name="telefono" type="text"><br>
64

Yovan Martinez committed
65 66
                                <label for="direccion">Direccion:</label>
                                <input required id="direccion" name="direccion" type="text"><br>
67

Yovan Martinez committed
68 69 70
                                <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>
71

72

Yovan Martinez committed
73 74
                                <label for="notebook">Cuenta con notebook</label>
                                <input id="notebook" name="notebook" type="checkbox"><br>
75

Yovan Martinez committed
76 77 78 79
                                <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
80

Yovan Martinez committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
                                <%@ 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>
104 105 106 107 108 109 110 111 112 113
                </article>
            </main>
        </body>
        </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;
114

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

                        checkValidity();
122
                    }
123
                }
124

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

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