dounei5721 2016-05-18 05:44
浏览 353

在laravel上设置值datetime-local

I want to add value in my edit form, with the value take from my database. but I don't know how to add value in the form of type datetime-local. I've tried but not appear.

here my view :

<div class='form-group col-sm-6'>
                        <label>Date Start</label>
                        <input class='form-control' value='{{ @$row->date_start }}' readonly />
                        <input type='datetime-local' class='form-control' name='date_start' value='{{ @$row->date_start }}' required/>
                    </div>
                    <div class='form-group col-sm-6'>
                        <label>Date End</label>
                        <input  class='form-control' value='{{ @$row->date_end }}' readonly />
                        <input type='datetime-local' class='form-control' name='date_end' value='{{ @$row->date_end }}' required/>
                    </div>

and here my controller :

public function postEditSave($id) {
        $simpan= array();
        $simpan['date_start']=Request::input('date_start');
        $simpan['date_end']=Request::input('date_end');
        $simpan['condition_status']=Request::input('condition_status');
        $simpan['id_cms_users']=Request::input('id_cms_users');
        $simpan['id_cms_companies']=Request::input('id_cms_companies');

        DB::table('log_patrols')->where('id', $id)->update($simpan);
        Session::flash('edit', 'Berhasil merubah data');
        return redirect('patrols');
    }

and this my database :

here

and for notice my date_start and date_end column is type datespam

can someone give me solution ? or did any other form input type can i use for my project ? which could take a date and time data directly? for to change type datetime-local ?

thanks...

sorry for my bad english.

  • 写回答

2条回答 默认 最新

  • douba3378 2016-05-18 05:47
    关注

    Try changing

    <input type='datetime-local'

    to

    <input type='date'

    in your view.

    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle触发器记录修改前后的字段值
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器