2016-12-13 5 views
0

多くの日付ピッカーを持つフォームを作成しましたが、テスト時にはいつでも自分が選択した日付に関係なく、2016年12月13日にテーブルに入力されます。jquery datepickerは1つの日付を挿入するだけです

var $j_custom = jQuery.noConflict(true); 
    $j_custom(function() { 
      $j_custom("#fromRow1").datepicker(); 
      $j_custom("#toRow1").datepicker(); 
      $j_custom("#fromRow2").datepicker(); 
      $j_custom("#toRow2").datepicker(); 
      $j_custom("#fromRow3").datepicker(); 
      $j_custom("#toRow3").datepicker(); 
      $j_custom("#fromRow4").datepicker(); 
      $j_custom("#toRow4").datepicker(); 
      $j_custom("#fromRow5").datepicker(); 
      $j_custom("#toRow5").datepicker(); 
      $j_custom("#fromRow6").datepicker(); 
      $j_custom("#toRow6").datepicker(); 
      $j_custom("#fromRow7").datepicker(); 
      $j_custom("#toRow7").datepicker(); 
      $j_custom("#fromRow8").datepicker(); 
      $j_custom("#toRow8").datepicker(); 
       }); 

document.addEventListener("submit", submitRequest); 
function submitRequest() { 
var gr = new GlideRecord('x_81991_federal_hc_sf_144'); 
gr.initialize(); 
    gr.agency_from_1 = document.getElementById('fromRow1').value; 
    gr.agency_from_2 = document.getElementById('fromRow2').value; 
    gr.agency_from_3 = document.getElementById('fromRow3').value; 
    gr.agency_from_4 = document.getElementById('fromRow4').value; 
    gr.agency_from_5 = document.getElementById('fromRow5').value; 
    gr.agency_from_6 = document.getElementById('fromRow6').value; 
    gr.agency_from_7 = document.getElementById('fromRow7').value; 
    gr.agency_from_8 = document.getElementById('fromRow8').value; 
    gr.agency_to_1 = document.getElementById('toRow1').value; 
    gr.agency_to_2 = document.getElementById('toRow2').value; 
    gr.agency_to_3 = document.getElementById('toRow3').value; 
    gr.agency_to_4 = document.getElementById('toRow4').value; 
    gr.agency_to_5 = document.getElementById('toRow5').value; 
    gr.agency_to_6 = document.getElementById('toRow6').value; 
    gr.agency_to_7 = document.getElementById('toRow7').value; 
    gr.agency_to_8 = document.getElementById('toRow8').value; 
gr.insert(); 
} 

どんなに私が日付を入力するものは、すべて私は:ここで私はこのすべてを書くために、よりエレガントな方法があります確信しているが、これは私はJSの私の基本知識をつなぎ合わせるために管理するもので、私のコードです参照これです:

enter image description here

私はこの問題を解決する方法上の任意の提案?ありがとう!!私はこのためのライブラリを使用してい

+0

は(私達にあなたのインサートを表示)だけでなく – ScanQR

+0

@TechBreakこんにちは、あなたがショーで何を意味するのか、あなたは私の挿入()? – Dave

+0

私はあなたのinsert()がdatepickerの値を設定していると仮定します。またはページの読み込み時に現在の日付を確認したいですか? – ScanQR

答えて

0

、それはあなたを助けるかもしれない:

$(function(){ 
    $(".select2").select2(); 
    //Datemask dd/mm/yyyy 
    $("#datemask").inputmask("dd/mm/yyyy", {"placeholder": "dd/mm/yyyy"}); 
    //Datemask2 mm/dd/yyyy 
    $("#datemask2").inputmask("mm/dd/yyyy", {"placeholder": "mm/dd/yyyy"}); 
    //Money Euro 
    $("[data-mask]").inputmask(); 

    //Date range picker 
    $('#reservation').daterangepicker(); 
    //Date range picker with time picker 
    $('#reservationtime').daterangepicker({timePicker: true, timePickerIncrement: 30, format: 'MM/DD/YYYY h:mm A'}); 
    //Date range as a button 
    $('#daterange-btn').daterangepicker(
     { 
      ranges: { 
       'Today': [moment(), moment()], 
       'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 
       'Last 7 Days': [moment().subtract(6, 'days'), moment()], 
       'Last 30 Days': [moment().subtract(29, 'days'), moment()], 
       'This Month': [moment().startOf('month'), moment().endOf('month')], 
       'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] 
      }, 
      startDate: moment().subtract(29, 'days'), 
      endDate: moment() 
     }, 
     function (start, end) { 
      $('#daterange-btn span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); 
     } 
    ); 

    //Date picker 
    $('#datepicker').datepicker({ 
     autoclose: true 
    }); 

をjQueryのに加えて、ブートストラップ・datepicker.jsを取得します。

誰かがこのような機能を備えて無料のテンプレートを作成し、そしてコードは無料です。

AdminLTE Template

関連する問題