首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何打开摄像头将二维码扫描到Google表单域?

如何打开摄像头将二维码扫描到Google表单域?
EN

Stack Overflow用户
提问于 2020-08-06 03:42:14
回答 1查看 1.1K关注 0票数 0

我们使用Google表单来跟踪特定事件的输入。工作人员和参会者输入他们的身份证号码,该号码将与二维码一起分发。

我的任务是尝试弄清楚如何访问iPads摄像头(我们使用iPads进行表单)来扫描与会者的二维码,并将他们的ID号从代码中输入到表单的正确字段中。

我相信我们可以以某种方式使用Google Apps脚本,但我不确定。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-08-06 04:19:51

最近对用于webapps的iphone对话框进行了更改,使我可以访问一个对话框,该对话框允许我选择上传文件的位置,其中一个选项是摄像头。我上传了一张显示对话框的图片。我还包括了我的html,这样你就可以看到这只是一个文件上传。也许这会有所帮助。

带对话框的应用程序图像:

这是我的html:

代码语言:javascript
复制
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
    <script>
      $(function(){
        google.script.run
        .withSuccessHandler(function(rObj){
          $('#dt').val(rObj.date);
        })
        .initForm();
        
      });
      function fileUploadJs(frmData) {
        var amt=$('#amt').val();
        var vndr=$('#vndr').val();
        var img=$('#img').val();
        if(!amt){
          window.alert('No amount provided');
          $('#amt').focus();
          return;
        }
        if(!vndr) {
          window.alert('No vendor provided');
          $('#vndr').focus();
          return;
        }
        if(!img) {
          window.alert('No image chosen');
          $('#img').focus();
        }
        document.getElementById('status').style.display ='inline';
        google.script.run
        .withSuccessHandler(function(hl){
          document.getElementById('status').innerHTML=hl;
        })
        .uploadTheForm(frmData)
      }
      console.log('My Code');
    </script>
    <style>
      input,textarea{margin:5px 5px 5px 0;}
    </style>
  </head>
   <body>
    <h3 id="main-heading">Receipt Information</h3>
    <div id="formDiv">
      <form id="myForm">
        <br /><input type="date" name="date" id="dt"/>
        <br /><input type="number" name="amount" placeholder="Amount" id="amt" />
        <br /><input type="text" name="vendor" placeholder="Vendor" id="vndr"/>
        <br /><textarea name="notes" cols="40" rows="2" placeholder="NOTES"></textarea>
        <br/>Receipt Image
        <br /><input type="file" name="receipt" id="img" />
        <br /><input type="button" value="Submit" onclick="fileUploadJs(this.parentNode)" />
      </form>
    </div>
  <div id="status" style="display: none">
  <!-- div will be filled with innerHTML after form submission. -->
  Uploading. Please wait...
  </div>  
</body>
</html>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63272483

复制
相关文章

相似问题

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