HTML - Deshabilitar Formulario Permanentemente

 
Vista:
sin imagen de perfil

Deshabilitar Formulario Permanentemente

Publicado por Lesther (1 intervención) el 28/08/2017 18:38:25
Saludos.

Estoy creando una pequeña aplicación para solicitar vehículos, las solicitudes de vehículos se realizan cada dos semanas, el problema que tengo es que necesito deshabilitar el formulario por completo durante dos semanas y que aparezca un mensaje informando que aun no están disponibles las solicitudes y luego habilitarlo de nuevo,( parecido a los formularios de Google)


agradezco su ayuda.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function deshab() {
  frm = document.forms['Solicitud'];
  for(i=0; ele=frm.elements[i]; i++)
    ele.disabled=true;
  }
  function hab() {
  frm = document.forms['Solicitud'];
  for(i=0; ele=frm.elements[i]; i++)
    ele.disabled=false;
}
</script>
          <style type="text/css">
	              #cointaner {
		             width: 49%;
		             height: 746px;
		             background: white;
		             margin-top: -4px;
                 box-shadow: 8px 8px 8px #515A5A;
		            }
          </style>
 
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
          <meta charset="UTF-8">
	      <title>Solicitud de Vehículos</title></head>
 <body style="background-color: rgb(0, 152, 119);">
  <center>
  <a href="Solicitudes_Realizadas.php" target="_blank" ><font color="#FBFBEF" size="4">Solicitudes de Vehículos Realizadas</font></a>
  &nbsp;&nbsp;
  <a href="acceso_aprobar.php" target="_blank"><font color="#FBFBEF" size="4">Solicitudes de Vehículos por Aprobar</font></a>
  &nbsp;&nbsp;
  <a href="programacion.php" target="_blank"><font color="#FBFBEF" size="4">Ver Programación de Vehículos</font></a></center>
               <br>
 
                <center><div id="cointaner">
 
               <br>
               <br>
               <br>
 
      <img style="width: 253px; height: 69px;" alt="" src="media/CIlogo_7597Red%20PNG.png">
     <center> <div style="font-family: Avenir; text-decoration: underline; color: rgb(0, 152, 119);"><h1>Solicitud de Vehículo</h1></div></center>
	<form name="Solicitud" action="guardar.php" method="post">
<divstyle ="text-align: left;"><?php include("conexion.php");
	$sql_mostrar=("SELECT * FROM departamento order by nombre asc" );
	$resultado = $conex->query($sql_mostrar);
?>
 
 </divstyle><center><div style="color: rgb(0, 152, 119);"><big style="font-weight: bold;"><span style="font-family: Avenir;">Departamento:</span>
      </big>
    <select style="color: rgb(0, 152, 119);" font-weight="" bold="" name="departamento" required="required"><option selected="selected">
		<?php foreach ($resultado as $fila){ header("Content-Type: text/html;charset=utf-8");?>
		</option><option> <?php echo $fila['nombre'];?></option><?php header("Content-Type: text/html;charset=utf-8"); } ?></select></div></center>
       <br>
       <br>
    	<?php mysqli_close($conex)
		?>
 
       <?php include("conexion.php");
	   $sql_personal=("SELECT * FROM personal order by Primer_nombre asc" );
	   $resultado_personal = $conex->query($sql_personal);
	   ?>
 
 
                 <center>  <div style="color: rgb(0, 152, 119);">
                         <big style="font-weight: bold; font-family: Avenir;">Solicitante:
                         </big>
                        <select name="empleado" required="required"><option selected="selected">
		                     <?php foreach ($resultado_personal as $fila){ ?>
		                     </option><option> <?php echo $fila['Primer_nombre'];?><?php echo " ";?><?php echo $fila['Primer_apellido'];?></option><?php } ?></select></div></center>
 
              <br>
            	<?php mysqli_close($conex)
		         ?>
 
<?php include("conexion.php");
     $sql_destino=("SELECT * FROM centros order by abreviatura asc" );
     $resultado_destino = $conex->query($sql_destino);
     ?>
 
                  <center> <div style="color: rgb(0, 152, 119);">
                   <big style="font-weight: bold; font-family: Avenir; color: rgb(0, 152, 119);">Donde Viajará:</big>
                   <select name="destino" required="required"><option selected="selected">
                         <?php foreach ($resultado_destino as $fila){ ?>
                         </option><option> <?php echo $fila['abreviatura'];?></option><?php } ?></select>
             </div>
              <?php mysqli_close($conex)
            ?>
    <br>
   <center> <big style="font-weight: bold; font-family: Avenir; color: rgb(0, 152, 119);">Cuantos Viajaran:</big>
                <input name="cantidad" required="required" type="text"></center>
    <br>
    <br>
<center style="color: rgb(0, 152, 119);"><big style="font-weight: bold; font-family: Avenir;">Fecha de Salida:</big>
                      <input name="fecha_salida" required="required" type="date">
 
<big style="font-weight: bold; font-family: Avenir;">Fecha de regreso:</big>
                 <input name="fecha_regreso" required="required" type="date"><center>
 
	<br>
<center style="color: rgb(0, 152, 119);"><big style="font-weight: bold; font-family: Avenir;">Hora Salida:</big> <input name="hora_salida" required="required" type="time">
<big style="font-weight: bold; font-family: Avenir;">Hora Regreso:</big> <input name="hora_regreso" required="required" type="time"><center>
	<br>
<center style="color: rgb(0, 152, 119);"><big style="font-weight: bold; font-family: Avenir;">Actividad a Realizar:</big><br><center>
 
<center style="font-family: Avenir;"><textarea ="" style="width: 600px; height: 100px;" rows="" maxlength="600" name="comentarios"></textarea></center>
    <br>
 
<input style="font-weight: bold; font-family: Avenir; color: rgb(0, 152, 119);" value=" Enviar Solicitud" type="submit">
 
 
</form>
 
 </center></div>
<input type="button" value="Deshabilitar" onclick="deshab()" />
<input type="button" value="Deshabilitar" onclick="hab()" />
 
<form name="Solicitud" disabled></form>
</center>
</center>
 
</center></center></center></center></form></body></html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Enrique
Val: 105
Ha mantenido su posición en HTML (en relación al último mes)
Gráfica de HTML

Deshabilitar Formulario Permanentemente

Publicado por Enrique (36 intervenciones) el 28/08/2017 19:40:07
No soy muy bueno en php pero siento que puedes mandar un flag que calcule si ya pasarón 15 días;
y con esto mandar un bool y al tener ese flag, con query podrías poner esta instrucción:
1
2
3
4
$(document).ready(function(){
     $('#Boton_Submit').attr('type','button');
     $('#Boton_Submit').attr("onclick","alert('Aún no están disponibles las solicitudes')");
});
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de Pedro
Val: 277
Bronce
Ha mantenido su posición en HTML (en relación al último mes)
Gráfica de HTML

Deshabilitar Formulario Permanentemente

Publicado por Pedro (15 intervenciones) el 30/08/2017 00:33:39
Una forma de solucionarlo que es la que se me ocurre es almacenar la fecha de notificación en algún sitio, entonces cuando se carge la página con php si es la fecha o no.

Si es la fecha entonces con echo '' formas el form.

Otra idea que se me ocurre es hacerlo con javascript , alguna petición ajax que retorne true o false y según reciba esa información pues haga lo siguiente:

1
2
3
4
5
6
7
function asd(a)
{
    if(a==true)
    document.getElementById("myform").style.display="none";
    else
    document.getElementById("myform").style.display="block";
}

No sé si habrás captado la idea o no pero es lo que se me ocurre in this moment..!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar