0

当我提交表单编辑引导模式时,控制台出现错误:

this.options.fields[field] is undefined

但有时我没有收到错误,尽管我提交了相同的数据

我使用了引导验证器和模态引导

$("#frmEdit<?php echo judulAdministrationsDefault(); ?>").bootstrapValidator({
live: 'enabled',
message: 'This value is not valid',
submitButton: '$frmEdit<?php echo judulAdministrationsDefault(); ?> button[type="submit"]',
submitHandler: function(validator, form, submitButton) {
    $("#loadingSaving").html("<center style='padding: 10px'><img src='<?php echo base_url()?>assets/images/loading.gif'></center>");
    var data = new FormData(document.getElementById("frmEdit<?php echo judulAdministrationsDefault(); ?>"));
    $.ajax({
      url:'<?php echo base_url().judulAdministrationsDefault()."/simpan_create_".judulAdministrationsDefault()."/"; ?>',
      type: "POST",             
      data:  data,    
      contentType: false,           
      cache: false,         
      processData:false,
      async: true, 
      success: function(data){
        console.log(data);
        var tmp = eval('('+data+')');
        if(tmp.successFlag==true){
          refreshData_<?php echo judulAdministrationsDefault(); ?>();
          $('#message_status').html('<div class="alert alert-success fade in"><button class="close" data-dismiss="alert">×</button><i class="fa-fw fa fa-check"></i><strong>Success</strong> Data berhasil disimpan.</div>');
          setTimeout(function(){ $('#edit_<?php echo judulAdministrationsDefault(); ?>').modal('hide');},2000);
        }else{
          $("#loadingSaving").html("");
          $('#message_status').html('<div class="alert alert-danger fade in"><button class="close" data-dismiss="alert">×</button><i class="fa-fw fa fa-times"></i><strong>Error!</strong>'+tmp.error_msg+'</div>');
          setTimeout(function(){ $('#message_status').html(''); },3000);
        }
      }         
    });
  return false;
}

});

图片

4

0 回答 0