jquery datepicker input value itself when leaved empty(codeigniter)
<p>excuse me, i am still a nubie in programming and want to make an edit page with datepicker in it. 
the problem is, when i leave the datepicker input null and proceed to submit the edited data, datepicker automatically input data to database with its oldest date.</p>

<p>my question is, how to make a validation when the datepicker is not filled, system will not input anything to database?</p>

<p>this is the datepicker script in view</p>

<pre><code> &lt;script&gt;
  $(function() {
    $( "#datepicker" ).datepicker();
    $("#datepicker").datepicker('setDate', null);
  });
  $(function() {
    $( "#selesai" ).datepicker();
    $( "#selesai").datepicker('setDate', null);
  });
  &lt;/script&gt;
</code></pre>

<p>and here is the doEdit function in controller</p>

<pre><code>public function doEdit(){
    $id_req = $this-&gt;input-&gt;post('idrequest');
    //$fnama = $this-&gt;input-&gt;post('first');
    //$lnama = $this-&gt;input-&gt;post('lnama');
    //$email = $this-&gt;input-&gt;post('email');
    //$subto = $this-&gt;input-&gt;post('submitted');
    $reqtype = $this-&gt;input-&gt;post('reqtype');
    $status = $this-&gt;input-&gt;post('jenisstatus');
    $date_mulai = $this-&gt;input-&gt;post('datepicker'));
    $date_selesai = $this-&gt;input-&gt;post('selesai'));


    //$date_selesai = $this-&gt;input-&gt;post('selesai');
    //$message = $this-&gt;input-&gt;post('message');


    $type = $this-&gt;db-&gt;query("SELECT reqType,nomorUrut FROM tbl_request WHERE id_request = '$id_req'");
    $cek_nomor = $this-&gt;db-&gt;query("SELECT nomorTiket FROM tbl_request WHERE id_request='$id_req' ");
    $res_tipe = $type-&gt;row();
    $tipe_request = $res_tipe-&gt;reqType;
    $nomor_urut = $res_tipe-&gt;nomorUrut;
    $res = $cek_nomor-&gt;row();
    if($tipe_request == $reqtype){
        $nomors = $res-&gt;nomorTiket;
    }else{
        $cek_tgl = $this-&gt;db-&gt;query("SELECT dateSubmit, firstName, lastName FROM tbl_request WHERE id_request = '$id_req' ");
        $cek_urutan = $this-&gt;db-&gt;query("SELECT max(nomorUrut) as terakhir FROM tbl_request WHERE reqType = '$reqtype' ");
        $res_tgl = $cek_tgl-&gt;row();
        $res_urut = $cek_urutan-&gt;row();

        $tglSubmit = date("dmY", strtotime($res_tgl-&gt;dateSubmit));
        $fnama = $res_tgl-&gt;firstName;
        $lnama = $res_tgl-&gt;lastName;

        $urutTerakhir = $res_urut-&gt;terakhir;
        $nomor_urut = $urutTerakhir +1;

        if($reqtype==1){
            $tipe = "B";
        }else{
            $tipe = "J";
        }
        $nomors = strtoupper($tipe.$nomor_urut."-".$fnama[0].$lnama[0]."-".$tglSubmit);
    }
    $data = array(
        "nomorTiket"=&gt;$nomors,
        "reqType"=&gt;$reqtype,
        "status"=&gt;$status,
        "nomorUrut"=&gt;$nomor_urut,
        "startDate"=&gt;date("Y-m-d", strtotime($date_mulai)),
        "endDate"=&gt;date("Y-m-d", strtotime($date_selesai))
    );
    $id = array(
        "id_request"=&gt;$id_req
    );
    $this-&gt;m_ticketing-&gt;update_data($data, $id);
    //echo $nomors."&lt;br&gt;idreq".$id_req."&lt;br&gt;req".$reqtype."&lt;br&gt;submit".$tglSubmit."&lt;br&gt;c".$c."&lt;br&gt;".$jmlChara."&lt;br&gt;idreq".$id_request."&lt;br&gt;".$fnama;
    redirect("index/data_admin");
}
</code></pre>

<p>that's my question, thank you</p>