停止我的表格继续错误

时间:2016-04-25 18:16:39

标签: javascript jquery twitter-bootstrap

为什么我的表单在validate.js显示错误时向下移动并向右移动一点?我只是想不出来,我可以调整它。我正在使用bootstrap。我真的很感激任何帮助。感谢。

jquery

$(document).ready(function(){
 $("#message").hide();

  //Define your validation rules.
  $("#bill_cost").validate({
    expression: "if (!isNaN(VAL) && VAL) return true; else return false;",
    message: "error"

  });
//Define the event that will occur when the entire form is validated (on form submission)
  $('#myform').validated(function(){
    var formdata = $('#myform').serialize();
 //Post form data
    $.post('../php_includes/insert.php', formdata, function(data){
      //Process post response
      $("#message").html(data);
      $("#message").fadeIn(500); 
      $("#message").fadeOut(500); 
    });

    //Reset Form
    $('#myform')[0].reset(); 
  });

});

这是表格

<form class="form-inline" action="" id="myform" method="post">

<!-- Text input-->
<div class="form-group">
  <label class="col-md-4 control-label" for="bill_cost"></label>  
  <div class="col-md-8">
  <input id="bill_cost" name="bill_cost" type="text" placeholder="Bill Cost" class="form-control input-lg" required>

  </div>
</div>


<!-- Button -->
<div class="form-group">
  <label class="col-md-4 control-label" for="submit1"></label>
  <div class="col-md-4">
    <button type="submit" id="submitButtonId" name="submit1"  class="btn btn-primary btn-xl">Submit</button>
  </div>
</div>


</form>

0 个答案:

没有答案