Phonegap相机API(iOS)提交FORM?

问题描述:

我在窗体中放置了一个摄像头按钮,因此您可以拍摄照片并将URI保存到localStorage变量。问题在于每次启动相机时,都会提交表单,而不会触及提交按钮,因此URI永远不会存储。我需要它不触发submitForm()。任何见解?Phonegap相机API(iOS)提交FORM?

哦,该应用程序正在使用jquerymobile。

HTML表单

  <form method="post" onsubmit="return submitForm()" id="myForm" data-ajax="false"> 
       <lable for="title" class="ui-hidden-accessible">Title</lable><input type="text" name="title" placeholder="Title"><br> 
       <button onclick="capturePhoto()">Camera</button><br> 
       <input type="text" name="description" placeholder="description"> 
       <input type="submit" value="submit"> 
      </form> 

JS

功能submitForm(){ db.transaction(insertDB,errorCB); $ .mobile.changePage(“#page2”,{reverse:false,transition:“slide”}); 返回false; }

功能capturePhoto(){// 取图像使用设备照相机和检索图像作为base64编码串 navigator.camera.getPicture(onPhotoDataSuccess,onFail,{质量:50,destinationType:Camera.DestinationType.FILE_URI }); }

发现问题。我用相机的<button>标签。这将触发onsubmit事件。我用了一个普通的<a href>代替,并且工作。