首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用QRCODE扫描器扫描值后打开引导模式

问使用QRCODE扫描器扫描值后打开引导模式
EN

Stack Overflow用户
提问于 2020-12-21 13:22:37
回答 1查看 249关注 0票数 0

我有一个表单,当用户将他们的二维码扫描到扫描仪中时,将弹出一个模式,其中包含他们的详细信息。

上一次我使用这个解决方案成功地完成了。How to open a bootstrap modal box after submitting a form by barcode scanner

但现在,它不再起作用了。

这是我的代码

代码语言:javascript
复制
<form name = "auto_barcode" id="auto_barcode" action="" method="post"> 
    <div class="form-group center">
        <label class="label-material active" style="font-color: #4b0082; ">ID number</label>
        <input id="employee_qrcode" type="password" name="employee_qrcode" required="" class="form-control center" autofocus placeholder="Type your employee ID number here">
    </div>
</form>

我的模式:

代码语言:javascript
复制
<div class="modal fade" id="myModal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" aria-hidden="true" class="modal fade text-left">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header primary-bg">
                <h4 id="exampleModalLabel" class="modal-title" style="color: white;">online health declaration form </h4>
            </div>
            <div class="modal-body">
                <div class="form-group row"> 
                    <input id="employee_qrcode1" type="text" class="form-control form-control-success " value="" disabled hidden="true" >
                    <label  class="col-md-12 form-control-label" style="font-size: 30px; font-weight: bold; margin-left: 20px; " id="info_employee_name" type="text" ></label> 
                    <label class="col-md-12 form-control-label" id="info_employee_address" type="text" style="font-weight: bold; font-size: 15px; margin-left: 20px; ">Km. 38 B, Balasing Road, Pulong Buhangin, Santa Maria, Bulacan</label>
                    <label class="col-md-12 form-control-label" id="info_employee_contactNo" style="font-weight: bold; font-size: 15px; margin-left: 20px; " type="text" >0915-333-5984</label>
                    <label class="col-md-12 form-control-label" id="info_employee_section" style="font-weight: bold; font-size: 15px;margin-left: 20px; " type="text" >RICTMS</label>
                </div>  
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card-body">
                            <div class="form-group row">
                                <label class="col-md-8 form-control-label"  style="font-weight: bold;">Body Temperature:</label>
                                <div class="col-md-10">
                                    <input id="body_temperature" type="text" class="form-control form-control-success" style="resize: none; color: blue; text-transform: uppercase;" name="body_temperature"/>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-md-8 form-control-label"  style="font-weight: bold;">Places visted and transited within the last 14 days:</label>
                                <div class="col-md-10">
                                    <input id="place_visited14" type="text" class="form-control form-control-success" style="resize: none; color: blue; text-transform: uppercase;" name="place_visited14"/>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-md-8 form-control-label"  style="font-weight: bold;">Have you been hospitalized for the past 14 days?</label>
                                <div class="col-md-10">
                                    <div class="custom-control custom-radio">
                                        <input type="radio" name="is_hospitalized" value="YES" /> YES <br>
                                        Please describe condition.<br>
                                        <input id="employee_condition_hospitalized" type="text" class="form-control form-control-success" style="resize: none; color: blue; text-transform: uppercase;" name="employee_condition_hospitalized"><br>
                                    </div>
                                </div>
                                <div class="col-md-10">
                                    <div class="custom-control custom-radio">
                                        <input type="radio" checked="true" name="is_hospitalized" value="NO"/> No 
                                    </div>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-8 form-control-label"  style="font-weight: bold;">In the last 14 days, did you have any of the following : Fever, Colds, Cough, Sore Throat or Difficulty in Breathing?</label>
                                <div class="col-md-10">
                                    <div class="custom-control custom-radio">
                                        <input type="radio" name="is_symptoms" value="YES"/> YES <br>
                                        Please specify.<br>
                                        <input id="employee_condition_symptoms" type="text" class="form-control form-control-success" style="resize: none; color: blue; text-transform: uppercase;" name="employee_condition_symptoms"><br>
                                    </div>
                                </div>
                                <div class="col-md-10">
                                    <div class="custom-control custom-radio">
                                        <input type="radio" checked="true" name="is_symptoms" value="NO"/> No 
                                    </div>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-8 form-control-label"  style="font-weight: bold;">Have you been identified as PUM/PUI?</label>
                                <div class="col-md-10">
                                    <div class="custom-control custom-radio">
                                        <input type="radio" name="is_pui" value="YES"/> YES
                                    </div>
                                </div>
                                <div class="col-md-10">
                                    <div class="custom-control custom-radio">
                                        <input type="radio" checked="true" name="is_pui" value="NO"/> No 
                                    </div>
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-8 form-control-label"  style="font-weight: bold;">Have you been in direct contact with or within the immediate vicinity of any person known to be a PUM/PUI?</label>
                                <div class="col-md-10">
                                    <div class="custom-control custom-radio">
                                        <input type="radio" name="is_contact" value="YES"/> YES
                                    </div>
                                </div>
                                <div class="col-md-10">
                                    <div class="custom-control custom-radio">
                                        <input type="radio" checked="true" name="is_contact" value="NO"/> No 
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div> 
            </div>
            <div class="modal-footer">
            <div class="form-group row">       
                <div class="col-md-12">
                    <label><u>DECLARATION AND DATA PRIVACY CONSENT FORM:</u><br><br>
                    The information I have given is true, correct and complete. I understand that failure to answer any question or giving false answer can be penalized in accordance with law. I voluntarily and freely consent the collection and sharing of the above personal information only in the relation to the office safety protocols.</label>
                    <!-- <input type="submit" style="float:right" class="btn btn-primary" value="Save" id="btnSave"> -->
                    <button type="submit" id="btnSave" class="btn btn-success float-right btnSave" >Submit</button>
                    <button type="button" style="float:right; margin-right:10px;" class="btn btn-dark cancelBtn" data-dismiss="modal" aria-label="Close">Close</button>
                </div>
            </div>
        </div>
        </div>
    </div>
</div>

我的javascript:

代码语言:javascript
复制
$('#auto_barcode').submit(function () {
    event.preventDefault();
    var employee_qrcode = document.getElementById("employee_qrcode").value;
    // var employee_qrcode = $(this).data('value');
    $.ajax({
        type: 'post',
        url: base_url+'Main_scan/ohdf_employee_details',
        data: {'employee_qrcode': employee_qrcode},
        success: function(data){
            var res1 = data.result1;
            if(data.success==1){
                document.getElementById('info_employee_name').innerHTML= res1[0].employee_fname+" "+res1[0].employee_mname+" "+res1[0].employee_lname;
                document.getElementById('info_employee_contactNo').innerHTML= "Contact Number:  "+res1[0].employee_contact_nop;
                document.getElementById('info_employee_address').innerHTML= "Address: "+res1[0].employee_address;
                document.getElementById('info_employee_section').innerHTML = "Division/Section/Unit:  "+res1[0].employee_section;
                $('#myModal').modal();
            } // add else toast here....
        }
    });
});

只有当我点击enter按钮时,模式才能工作,但特别是我需要在扫描ng QRcode之后显示它。

EN

回答 1

Stack Overflow用户

发布于 2020-12-21 15:07:58

我已经找到了我的问题的解决方案!我只是将我的二维码扫描器恢复为出厂默认设置。在我的代码中没有问题。:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65387868

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档