通过条形码扫描仪提交表单后如何打开引导程序模式框 [英] How to open a bootstrap modal box after submitting a form by barcode scanner

查看:96
本文介绍了通过条形码扫描仪提交表单后如何打开引导程序模式框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于条形码扫描的小表格.我扫描产品的条形码,然后会出现一个引导框.进入模态后,我会发布产品的条形码编号.模态内部还有另一种形式,它将检索产品的条形码编号,并将填充一些输入并将其插入到mysql数据库表中.

I have a small form for barcode scanning. I scan the barcode of a product and a bootstrap box will appear. Into the modal i post barcode number of product. And inside the modal there is another form, which will retrieve barcode number of product and will fill some inputs and insert it into the mysql database table.

<form name="barkod_oku" id="barkod_oku" action="" method="post" >
<input name="sto_barkod" id="sto_barkod" value="" autofocus placeholder="Barkod Numarası">
<input type="hidden" name="alis_fatura_no" value="<?php echo $finalcode1 ;?>">

</form>

这是我将2个值发布到模式框中的表格.

This is the form which i post 2 values into the modal box.

这是我想看到的模式框.(İ尚未将其他输入放入模态中.稍后我会输入.)

And this is the modal box which i want to see. ( İ haven't put otehr inputs into the modal yet.Later i will put.)

 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <div class="modal-dialog">
 <div class="modal-content">
 <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
    <h4 class="modal-title" id="myModalLabel">Modal title</h4>
  </div>
  <div class="modal-body">
    <input name="barkod_no" value="<?php echo $sto_barkod1; ?>">
    <input name="fatura_no" value="<?php echo $stok_kodu1; ?>">
  </div>
   </div>
 </div>
 </div>

而且我也使用此javascript打开模式框:

And also i use this javascript to open the modal box:

 <script>
 $('#barkod_oku').submit(function () {

    $('#myModal').modal('show');
 });
</script>

我认为一切正常,但模态并没有停留在屏幕上.它出现,然后在一秒钟内消失.我看不到要在屏幕上显示模态的缺失点是什么?

Shortly everything works fine i think but modal is not staying on the screen. It appears and then disappears in one second. What is the missing point that i can not see to hold the modal on screen?

推荐答案

您需要使用 防止提交按钮的默认操作

You need to use Prevent the default action of a submit button

$('#barkod_oku').submit(function () {
    event.preventDefault();
    $('#myModal').modal('show');
 });

这篇关于通过条形码扫描仪提交表单后如何打开引导程序模式框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆