1 | {% block extracss %} |
---|
2 | {% load staticfiles %} |
---|
3 | <link type="text/css" rel="stylesheet" href="{% static 'jquery-entropizer-master/dist/css/jquery-entropizer.min.css' %}" /> |
---|
4 | <link href="{% static 'bootstrap-3/css/bootstrap-toggle.min.css'%}" rel="stylesheet"> |
---|
5 | {% endblock extracss %} |
---|
6 | {% block extrajs %} |
---|
7 | <script src="{% static 'bootstrap-3/js/bootstrap-toggle.min.js'%}"></script> |
---|
8 | <script type="text/javascript" src="{% static 'jquery-entropizer-master/lib/entropizer.js' %}"></script> |
---|
9 | <script type="text/javascript" src="{% static 'jquery-entropizer-master/dist/js/jquery-entropizer.min.js' %}"></script> |
---|
10 | <script type="text/javascript" src="{% static 'users/user_register.js' %}"></script> |
---|
11 | {% endblock extrajs %} |
---|
12 | <div class="modal-dialog modal-lg"> |
---|
13 | <div class="modal-content"> |
---|
14 | <form {% if tipo == '4' %} onsubmit="return validacion()" {% endif %} role="form" action="{% url 'explicacion:modificar_respuesta_' tipo pk %}" method="post"> |
---|
15 | <div class="modal-header"> |
---|
16 | <button type="button" class="close" data-dismiss="modal">x</button> |
---|
17 | {% if tipo == '1' %} |
---|
18 | <h3 class="text-center"> {{ o.opcion.pregunta }} </h3> |
---|
19 | {% else %} |
---|
20 | <h3 class="text-center"> {{ o.pregunta }} </h3> |
---|
21 | {% endif %} |
---|
22 | </div> |
---|
23 | <div class="modal-body"> |
---|
24 | {% csrf_token %} |
---|
25 | <div class="panel panel-default"> |
---|
26 | <div class="panel-body" style="text-align: center;"> |
---|
27 | <div class="row"><label>Respuesta</label></div> |
---|
28 | {{ formulario.respuesta}} |
---|
29 | {% if tipo == '4' %} |
---|
30 | <div id="div_justificacion"> |
---|
31 | <label>Justifique su respuesta</label> |
---|
32 | <div class="row"> |
---|
33 | {{ formulario.justificacion.errors }} |
---|
34 | {{ formulario.justificacion }} |
---|
35 | </div> |
---|
36 | </div> |
---|
37 | {% endif %} |
---|
38 | </div> |
---|
39 | </div> |
---|
40 | </div> |
---|
41 | <div class="modal-footer"> |
---|
42 | <div class="col-lg-12 text-right"> |
---|
43 | <input type="submit" class="btn btn-primary" name="submit" value="Guardar"> |
---|
44 | <button type="button" class="btn btn-default" onclick="return cerrar_modal()"> |
---|
45 | Cancelar |
---|
46 | </button> |
---|
47 | </div> |
---|
48 | </div> |
---|
49 | </form> |
---|
50 | </div> |
---|
51 | </div> |
---|
52 | <script type="text/javascript"> |
---|
53 | $(function(){ |
---|
54 | var select = document.getElementById('id_respuesta'); |
---|
55 | |
---|
56 | if (select.value == "True" ){ |
---|
57 | $('#div_justificacion').hide(); |
---|
58 | }else if (select.value == "False" ){ |
---|
59 | $('#div_justificacion').show(); |
---|
60 | } |
---|
61 | |
---|
62 | $('#id_respuesta').on('change', function (){ |
---|
63 | var select = document.getElementById('id_respuesta'); |
---|
64 | if (select.value == "True" ){ |
---|
65 | $('#div_justificacion').hide(); |
---|
66 | }else if (select.value == "False" ){ |
---|
67 | $('#div_justificacion').show(); |
---|
68 | } |
---|
69 | }); |
---|
70 | }); |
---|
71 | function validacion() { |
---|
72 | var select = document.getElementById('id_respuesta'); |
---|
73 | var justificacion = document.getElementById('id_justificacion'); |
---|
74 | if (select.value == "False" && justificacion.value == '') { |
---|
75 | alert('Complete el campo de justificacion'); |
---|
76 | return false; |
---|
77 | } |
---|
78 | return true; |
---|
79 | } |
---|
80 | </script> |
---|