Funcion jquery:
Código:
Formulario:<script type="text/javascript"> jQuery(function($){ $.datepicker.regional['es'] = { closeText: 'Cerrar', prevText: '<Ant', nextText: 'Sig>', currentText: 'Hoy', monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio', 'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'], monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun', 'Jul','Ago','Sep','Oct','Nov','Dic'], dayNames: ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'], dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'], dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sá'], weekHeader: 'Sm', dateFormat: 'dd/mm/yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['es']); }); $(function() { $( "#item_datepicker" ).datepicker({ dateFormat:'dd/mm/yy', altFormat:'yy-mm-dd', altField:'#elotrocampo' } ); $( "#item_datepicker2" ).datepicker({ dateFormat:'dd/mm/yy', altFormat:'yy-mm-dd', altField:'#elotrocampo2' } ); }); $(document).ready(function() { $("#datepicker").datepicker(); $("#datepicker2").datepicker(); }); </script>
Código:
<form class='form-horizontal well' data-async data-target='#rating-modal' method="POST"> <div class='form-group'> <label for='nombre' class='col-lg-2 control-label'>Nombre</label> <div class='col-lg-10'> <input type='text' class='form-control' name='nombre' id='nombre'> </div> </div> <div class='form-group'> <label for='cclte' class='col-lg-2 control-label'>Cliente</label> <div class='col-lg-10'> <select class='form-control' id="cclte" name="cclte"> <?php if(!$nuevo_obras){ echo "<option value=''>Seleccione</option>"; }else{ echo "<option value='$nuevo_obras[0]'>$nuevo_obras[1]</option>"; } while($fila=mysqli_fetch_array($res)){ ?> <option value="<?php echo $fila['codigo']; ?>"><?php echo $fila['nombre']; ?></option> <?php } ?> </select> </div> </div> <div class='form-group'> <label for='feini' class='col-lg-2 control-label'>Fecha Inicio</label> <div class='col-lg-10'> <input type="date" id="item_datepicker"><input type="hidden" id="elotrocampo" name="datepicker"><br /> </div> </div> <div class='form-group'> <label for='fefin' class='col-lg-2 control-label'>Fecha Termino</label> <div class='col-lg-10'> <input type="date" class='form-control' id="item_datepicker2"><input type="hidden" id="id="elotrocampo2 name="datepicker2"><br /> </div> </div> </div> <div class='modal-footer'> <button onclick='registrarObra();' id="envio" value="envio" name= "envio" type='button' class='btn-flat'>Guardar</button> <button type='button' class='btn-flat white' data-dismiss='modal'>Cerrar</button> </div> </form>