2017-04-23 74 views
0

在下面的HTML代碼中,我有一個窗體,其中包含一個datetimepicker和一個動態生成的複選框 。如果通過提交按鈕提交表單,則所有複選框數據將按預期傳遞到後端,但datetimepicker條目不是。對不起,如果這是一個新問題,但我是前端工作的新手。謝謝!表單不提交DateTimePicker字段

<div class="container"> 
    <div class="row"> 
     <div class="col-md-6"> 
      <h4>Allergic Reaction History</h4> 
     </div> 
     <div class="col-md-6"> 
      <h4>Report An Allergic Reaction</h4> 
      <form action="{{ url_for('reactions') }}" method="post"> 
       <div class="form-group"> 
        <div class="col-md-10" id="dtpicker"> 
         <label class="control-label requiredField" for="datetimepicker1"> 
          Reaction date & time: 
          <span class="asteriskField">*</span> 
         </label> 
         <div class='input-group date form-group' id='datetimepicker1'> 
          <input type='text' class="form-control"/> 
          <span class="input-group-addon"> 
             <span class="glyphicon glyphicon-calendar"></span> 
             </span> 
         </div> 
         <span class="help-block" id="hint_name"> 
             Click the calendar icon to enter date then click the clock icon to enter time. 
             Approximations are okay. 
            </span> 
         <script type="text/javascript"> 
          $(function() { 
           $('#datetimepicker1').datetimepicker(); 
          }); 
         </script> 
          <label class="control-label requiredField" for="checkbox"> 
           Check all symptoms experienced: 
           <span class="asteriskField">*</span> 
          </label> 
          <div class="checkboxes" id="checkbox-div"> 
           {% for s in symptoms %} 
            <label class="checkbox-inline no_indent"> 
             <input title="{{ s.desc }}" name="checkbox" type="checkbox" value="{{ s._id }}"/> 
             {{ s._id }} 
            </label> 
           {% endfor %} 
           <span class="help-block" id="hint_name"> 
             Hover over the checkbox for a symptom to get more details about it. 
             </span> 
          </div> 
           <div> 
            <button class="btn btn-primary " name="submit" type="submit"> 
             Submit 
            </button> 
           </div> 
        </div> 
       </div> 
      </form> 
     </div> 
    </div> 
</div> 

回答