Error 400 when submitting form but information is still received in google sheet

google forms
google sheets
google sheets api
formstack google sheets integration
google form responses not showing up in spreadsheet 2019
how to edit google sheets online
google forms not updating spreadsheet
how to create google sheet

I am receiving a error 400 when submitting a form, yet the data is transferred to my Google Sheet as intended.

I've read up on what may cause a 400 error but my understanding is not advanced enough to spot the error in the code.

code.gs

function doGet() {
  return HtmlService
      .createTemplateFromFile('jSignature')
      .evaluate();
}

function saveImage(bytes, sign){
  var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('FormResponse');
  var dateObj = Date.now();
  var bytes = bytes.split(",")
  var blob = Utilities.newBlob(Utilities.base64Decode(bytes[1]), 'image/png');
  var fileName = blob.setName("Signature "+dateObj).getName();
  var sigFolder = DriveApp.getFolderById("myFolder"); //replace with your folder id
  var url = sigFolder.createFile(blob).getId();
  Logger.log(url)
  var carrier = sign.carrier;
  var address = sign.address;
  var dname = sign.dname;
  var dnum = sign.dnum;
  var date = sign.date;
  var time = sign.time;
  var tractortruck = sign.tractortruck;
  var odom = sign.odom;
  var imageCell = ss.getRange(ss.getLastRow()+1, 1, 1, 9).setValues([[carrier, address, dname, dnum, date, time, tractortruck, odom, url]]);
}

html

<!DOCTYPE html>
<html>
<head><meta name="viewport" content="width=device-width, initial-scale=2, maximum-scale=1, user-scalable=0"/></head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/willowsystems/jSignature/master/libs/jSignature.min.js"></script>
<style>
</style>
<body>
<center><h1><big><big>DRIVER VEHICLE INSPECTION REPORT</big></big></h1>
<h5>AS REQUIRED BY THE D.O.T. FEDERAL MOTOR CARRIER SAFETY REGULATIONS</h5></center><br>
<form id="customerForm" action="/action_page.php">
<div class="container">
  <label for="carrier">Carrier:</label>
    <select id="carrier" name="carrier" required>
      <option value="My Company">My Company</option>   
      </select><br>
    Location:
  <table id= "Address">
  <tr>
  <td>PDX</td>
  <td>EUG</td>
  <td>SEA</td>
  <td>SFO</td>
  </tr>
  <tr>
  <td><input type="radio" id="PDX" oninput="this.className = '';EUG.className = '';SEA.className = '';SFO.className = ''" name="Address" value="PDX"></td>

  <td><input type="radio" id="EUG" oninput="this.className = '';PDX.className = '';SEA.className = '';SFO.className = ''" name="Address" value="EUG"></td>

  <td><input type="radio" id="SEA" oninput="this.className = '';EUG.className = '';PDX.className = '';SFO.className = ''" name="Address" value="SEA"></td>

  <td><input type="radio" id="SFO" oninput="this.className = '';EUG.className = '';SEA.className = '';PDX.className = ''" name="Address" value="SFO"></td>
  </tr>
  </table>
      <label for="Driver name">Driver Performing Inspection:</label>
  <input type="text" id="dname" name="drivername" placeholder="Your full name" required><br>
  <label for="Driver Employee ID number">Driver's Employee Number:</label><br>
  <input type="number" id="dnum" name="drivernumber" placeholder="Your employee number" required><br><br>
  <label for="Date">Date Performed:</label><br>
  <input type="date" id="date" name="date" required><br><br>
  <label for="Time">Time Performed:</label><br>
  <input type="time" id="time" name="time" value="now" required><br><br>
  <label for="Tractor/Truck#">Tractor / Truck #:</label><br>
  <input type="number" id="tractor/truck" name="tractortrucknum" placeholder="Your vehicle number" required><br><br>
  <label for="Odometer">Odometer Reading:</label><br>
  <input type="number" id="odom" name="odometer" placeholder="Vehicle odometer reading" required><br><br>
<b><big>Signature:</big></b>
<div id="signature"></div><br>
<img id="rendered" src="" style="display:none">
<input type="submit" value="Submit and close" onclick="renderSignature();saveImage();"/>
</div>
</form>
</body>
<script>

  $("#signature").jSignature({
    'background-color': 'transparent',
    'decor-color': 'transparent',
  });

  function renderSignature(){
    $("img#rendered").attr("src",$('#signature').jSignature('getData','default'));
  }

    function saveImage(e){ //This sends the image src to saveImages function
    var bytes = document.getElementById('rendered').src;
    console.log(bytes);
    var sign = {
      carrier: document.getElementsByName('carrier')[0].value,
      address: $('input[name="Address"]:checked').val(),
      dname: document.getElementsByName('drivername')[0].value,
      dnum: document.getElementsByName('drivernumber')[0].value,
      date: document.getElementsByName('date')[0].value,
      time: document.getElementsByName('time')[0].value,
      tractortruck: document.getElementsByName('tractortrucknum')[0].value,
      odom: document.getElementsByName('odometer')[0].value,
    };
    alert("saveImage successful");
    google.script.run.saveImage(bytes, sign);
    return
  }

let date = new Date().toISOString().substr(0, 10);
document.querySelector("#date").value = date;

$(function(){     
  var d = new Date(),        
      h = d.getHours(),
      m = d.getMinutes();
  if(h < 10) h = '0' + h; 
  if(m < 10) m = '0' + m; 
  $('input[type="time"][value="now"]').each(function(){ 
    $(this).attr({'value': h + ':' + m});
  });
});
</script>
</html>

Ideally, I'd like to see the form take the user to a URL on submit. I think I can figure this out once we resolve the 400 issue. If anyone has advice, though, I'd love to hear it.


Google Sheets: Commonly Returned Errors – Formstack, Without the form updating the google sheet, this is creating problems still held in the Form database, so you should get every submission When unlinked and re-created, got the previous responses but not the ones received after linking. We found the following personal information in your message:. Issues editing Google Docs, Sheets, Slides & Forms If you have trouble opening or editing Google Docs, Sheets, Slides, or Forms, you can try some of the steps below. Note: If you have a problem with Google Drive, like uploading files or syncing documents, see the Google Drive Help Center .


Google form is not updating the sheet. It worked but not it isnt , I unlinked the sheet and re-linked it, and it made a new Forms Responses entries that we submitted today that were not showing up on the "old" form responses tab. We were going over the information and noticed it wasn't working; I have Notifications are currently off and you won't receive updates. If the person who created the form uses Google apps for work or education, they'll need to change a setting for their Google Form. Contact the person who created the form or sent it to you. Here’s a suggestion of what to say: "I received a Google Form from you, but I can't open it because it's restricted to people within your organization.


This might seem dumb, but it doesn't seem as though I use /action_page.php to collect the data, it is all done in JS through the functions saveImage and renderSignature. When looking at an old version of my code, I realized it didn't use /action_page.php. So that must be something I picked up along the way from trying to improve my code, but it appears to be unnecessary. When removed, all of my info is saved and transfers over to the google sheet exactly as I need it to and I don't get a 400 error on submit.

Thank you all for your help! I hope this can help someone else.

Google form has suddenly stopped populating the associated , The HyperText Transfer Protocol (HTTP) 400 Bad Request response status will not process the request due to something that is perceived to be a client error (​e.g. 400 Bad Request, Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content 203 Non-Authoritative Information · 204 No Content · 205 Reset Content  Get help and support for Google Sheets on Zapier. Search our Google Sheets help documentation, resolve common errors, and learn how to use Zapier.


400 Bad Request, Docs Support For the page specific to the Cloud Storage XML API, see HTTP status and Note that the header information in the responses is omitted. error response you receive if you try to list the buckets for a project but do not Example values include: 400 (Bad Request), 401 (Unauthorized), and 404 (Not Found). The process of correcting the mistake on your form may be quite easy in this case. To correct the mistake on a form you have already filed, you will have to wait until you receive the application receipt notice that tells you that your application has been received. A unique receipt number will be assigned to your case once the USCIS receives it.


HTTP status and error codes for JSON | Cloud Storage, Other API Errors: If you receive a non-201 status code response, see the HTTP Status See Connection Issues section for more info. If you aren't able to send and receive a push message and the relevant If you get stuck and are not sure what the problem is, then test in Firefox and 400, Invalid request. How to Receive Google Forms data in Email. Here’s how you can add email notifications to any Google Form in 5 easy steps: Install the Google Forms add-on, then click the add-ons icon inside the Forms Editor (it is the shape of a puzzle icon), choose the Email Notification for Forms menu and then click the Create New Rule menu.


Web Push: Common Issues and Reporting Bugs, Step 1 - Visitors should be able to enter and submit information. If visitors see an If the form is connected to an email address and you're not receiving these emails, see: Not receiving If you receive error notifications from Squarespace Instead, you'll see a blank field on the Google Sheet submission. The simplest way to start building a form is right from the Google Forms app. Go to docs.google.com/forms, then either choose a template or start a blank form. There's also a link to Google Forms in Docs, Sheets, and Slides: click File -> New -> Form to start a new blank form.