<script type="text/javascript">
    $(document).ready(function () {
        $('#form').validate(
            {
                rules: {
                    fecha_desde: {
                        required: true
                    },
                    fecha_hasta: {
                        required: true
                    }
                },
                focusCleanup: false,

                highlight: function (label) {
                    $(label).closest('.control-group').removeClass('success').addClass('error');
                },
                success: function (label) {
                    label
                        .text('OK!').addClass('valid')
                        .closest('.control-group').addClass('success');
                },
                errorPlacement: function (error, element) {
                    error.appendTo(element.parents('.controls'));
                }
            });
        <?php $this->load->view('partials/script_edit.php'); ?>
    }); // end document.ready
</script>
<form action="<?php echo $action; ?>" id="form" method="POST" enctype="multipart/form-data" class="form-horizontal"
      novalidate="novalidate">
    <input type="hidden" id="id" name="id" value="<?php echo (isset($row->id)) ? $row->id : "0"; ?>"/>
    <div id="page-title" class="clearfix">
        <span
            style="font-size:24px;font-weight:bold;float:left;margin-top:5px;"><?php echo (isset($row->id)) ? $dir2 : $dir1; ?></span>
        <div class="item-content" style="float:right;">
            <button type="submit" class="btn btn-inverse">Consultar</button>
        </div>
    </div> <!-- /.page-title -->
    <div class="row">
        <div class="span12">
            <div id="validation" class="widget highlight widget-form">
                <div class="widget-content">
                    <fieldset>

                        <?php //echo (isset($message))?$message:'';?>

                        <div class="control-group">
                            <label class="control-label" for="fecha_desde">Fecha desde</label>
                            <?php
                                $mes = date('m');
                                $anio = date('Y');
                                $desde = date('Y-m-d', mktime(0,0,0, $mes, 1, $anio));
                            ?>
                            <div class="controls">
                                <input type="date" class="input-large" name="fecha_desde" id="fecha_desde"
                                       value="<?php echo $desde; ?>">
                            </div>
                        </div>

                        <div class="control-group">
                            <label class="control-label" for="fecha_hasta">Fecha hasta</label>
                            <?php
                                $hasta = date('Y-m-d');
                            ?>
                            <div class="controls">
                                <input type="date" class="input-large" name="fecha_hasta" id="fecha_hasta"
                                       value="<?php echo $hasta; ?>">
                            </div>
                        </div>

                        <div class="form-actions">
                            <button type="submit" class="btn btn-inverse">Consultar</button>
                        </div>
                    </fieldset>
                </div>
            </div>
        </div>
    </div>
</form>