• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
daterangepicker form not working

#1
[eluser]Unknown[/eluser]
I'm using an example of bootstrap-datetimepicker in my codeigniter project. I create a form with only the datetimepicker input.

view:

Code:
<?php // Change the css classes to suit your needs    
       $attributes = array('class' => '', 'id' => '');
        echo form_open('/calendario/nadevent/', $attributes); ?>
       <div class="form-group">
       <label for="reservationtime">Fecha:</label>

       <div class="input-group">
       <span class="input-group-addon"><i class="fa fa-calendar"></i></span>&lt;input type="text"       name="reservationtime" id="reservationtime" class="form-control" value="&lt;?php echo       set_value('reservationtime') ?&gt;" /&gt;
       </div>

       </div>
   &lt;?php echo form_submit( 'submit', 'Submit','class="btn btn-default"'); ?&gt;
   &lt;?php echo form_close(); ?&gt;
JS:

Code:
$('#reservationtime').daterangepicker({timePicker: true, timePickerIncrement: 30, format: 'DD-MM-YYYY hh:mm:ss', timePicker12Hour: false, separator: '/'});

The datepicker works fine but when i submit the form, I want to format the data and split into an array:

Controller:

Code:
$this->form_validation->set_rules('reservationtime', 'reservationtime', '');
        $array  = explode('/',set_value('reservationtime'));

Then I try to insert the values:

Code:
$form_data = array(
                            'start' => $array[0],
                            'end' => $array[1]
                        );

But if I print the array, its empty:

Code:
Array ( [start] => [end] => )

Wha'ts wrong with the code?

Thanks for the help Smile


Messages In This Thread
daterangepicker form not working - by El Forum - 08-14-2014, 03:12 AM
daterangepicker form not working - by El Forum - 08-15-2014, 05:12 AM
daterangepicker form not working - by El Forum - 08-15-2014, 08:29 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.