|
This code is working fine , but how to prevent blank form submit, bcos its redirecting to page based on status code
|
|
|
|
|
Hi,
Thanks for you article, but I want to get or capture multiple checkbox value, so how could I, please help me.
|
|
|
|
|
Hi, I don't seem to have got it working, I have checked my entry names match up to the relevant forms.
Is there a way I can get some help?
Thanks
Steve
|
|
|
|
|
This code really helped me put data into google spreadsheet from a customized form, and more importantly, put the adwords tracking code on the Thank you page.
Have you put in the reference to jquery before the script? I put this code:
and this solved the problem. Of course, you need to put that .js file in the same directory as the html file. You can download the file from .[^]
Hope this works!
|
|
|
|
|
I keep getting a 302 response from google. The code looks like its changed a lot in the forms. The name field is using a different format now, I only see entry.1142708822 , nothing in the kind of format suggested above -- eg: entry_1142708822
I tried both, still no luck
Any suggestions?
Heres my code
<br />
<hr><br />
<input id="Email" name="email" <br />
type="text" placeholder="Email Address"><br />
<input id="First" name="name" <br />
type="text" placeholder="First Name"><br />
<button id="ButtonSubmit" onclick="postContactToGoogle()" <br />
type="button" >Send</button> <br />
<br />
<script><br />
function postContactToGoogle() {<br />
var email = jQuery('#Email').val();<br />
var name = jQuery('#First').val();<br />
<br />
jQuery.ajax({<br />
url: "https://docs.google.com/forms/d/1cZnO17y1cgSGXn4WaGLWNoLnZT-GjDICOWVJ0ErKGvs/formResponse",<br />
data: { "entry_1142708822": email,<br />
"entry.607350405": name },<br />
type: "POST",<br />
dataType: "xml",<br />
statusCode: {<br />
0: function () {<br />
alert('success?');<br />
},<br />
200: function () {<br />
alert("or fail?");<br />
}<br />
}<br />
});<br />
}<br />
</script><br />
|
|
|
|
|
Works great with Chrome, but doesn't work with Explorer and Firefox browsers.
Any thoughts?
|
|
|
|
|
Hey
How can you add to a form field to keep coordinates entered by the user on the map google ?
Thanks , I greet Paul
|
|
|
|
|
It really help me to overcome with the stuff I am facing to inserting the values in Spreadsheet and after reading this section I got it Successfully in couple of minutes. 
|
|
|
|
|
Can you tell me - where I am wrong ....
<form action="https://docs.google.com/forms/d/1TmQ0sG_OAy6yFKJNSM1dXz5lKKDkmNBhA0sjn8ujvhk/formResponse" method="POST" id="ss-form" target="_self" onsubmit="">
<input type="submit" name="submit" id="submit" value="Submit" class="btn btn-info pull-right" onclick="postContactToGoogle()" style="margin-bottom:20px;">
</form>
<script src="http://code.jquery.com/jquery-1.11.0.js"></script>
<script>
function postContactToGoogle() {
var name = $('#name').val();
var dob = $('#dob').val();
var email = $('#email').val();
var address = $('#address').val();
var contactno = $('#contactno').val();
var InputMessage = $('#InputMessage').val();
$.ajax({
url: "https://docs.google.com/forms/d/1TmQ0sG_OAy6yFKJNSM1dXz5lKKDkmNBhA0sjn8ujvhk/formResponse",
data: {
"entry.1442801838": name
"entry.483517062": dob
"entry.81251864": email
"entry.967451853": address
"entry.1998494975": contactno
"entry.44071033": InputMessage },
type: "POST",
dataType: "xml",
statusCode: {
0: function () {
window.location.replace("thank-you.html");
},
200: function () {
window.location.replace("thank-you.html");
}
}
});
}
</script>
|
|
|
|
|
Hello, I have tried your tutorial, but code doesn't work with checkboxes and drop-down lists. How to submit multiple values into one cell?
|
|
|
|
|
I follwed everything, but nothing happened, is this a joke ?
'
|
|
|
|
|
<html>
<head>
<title>
Daily Trip Log Sheet
</title>
</head>
<body>
Please put details.
<form action="https://docs.google.com/forms/d/1iHuOmQx0hXKH6DGb2GNUc-yu-0Iiv9PDkKPgAXX3Ldc/formResponse">
<input type="submit" value="GOOGL FORM">
</form>
<button id="ButtonSubmit" onclick="postContactToGoogle()" type="button" >POST</button>
<select id="Selectcarfromlist" name="model">
<option value="Renolds Scala">Renolds Scala</option>
<option value="Tata Aria">Tata Aria</option>
</select>
<input id="dryrun" name="Dry Run" type="text" placeholder="Dry Run">
<input id="Trip_Starting_Reading" name="Trip Starting Reading" type="text" placeholder="Trip Starting Reading">
<input id="From__" name="From" type="text" placeholder="From">
<input id="Diesel__" name="Diesel" type="text" placeholder="Diesel">
<input id="Toll__" name="Toll" type="text" placeholder="Toll">
<input id="Water_Bottel_" name="Water Bottel" type="text" placeholder="Water Bottel">
<input id="Tea__" name="Tea" type="text" placeholder="Tea">
<input id="Breakfast__" name="Breakfast" type="text" placeholder="Breakfast">
<input id="Lunch__" name="Lunch" type="text" placeholder="Lunch">
<input id="Maintainance__" name="Maintainance" type="text" placeholder="Maintainance">
<input id="Income__" name="Income" type="text" placeholder="Income">
<input id="To__" name="To" type="text" placeholder="To">
<input id="Trip_Finishing_Reading" name="Trip Finishing Reading" type="text" placeholder="Trip Finishing Reading">
<input id="Time__" name="Time" type="text" placeholder="Time">
<input id="Day_Starting_Reading" name="Day Starting Reading" type="text" placeholder="Day Starting Reading">
<input id="Day_Ending_Reading" name="Day Ending Reading" type="text" placeholder="Day Ending Reading">
<input id="Other__" name="Other" type="text" placeholder="Other">
<button id="ButtonSubmit" onclick="postContactToGoogle()" type="button" >POST</button>
<script>
function postContactToGoogle() {
var Select_car_from_list = $('#Selectcarfromlist').val();
var DRY_RUN_ = $('#dryrun').val();
var TRIP_STARTING_READING = $('#Trip_Starting_Reading').val();
var FROM__ = $('#From__').val();
var DIESEL__ = $('#Diesel__').val();
var TOLL__ = $('#Toll__').val();
var WATER_BOTTEL_ = $('#Water_Bottel_').val();
var TEA__ = $('#Tea__').val();
var BREAKFAST__ = $('#Breakfast__').val();
var LUNCH__ = $('#Lunch__').val();
var MAINTAINANCE__ = $('#Maintainance__').val();
var INCOME__ = $('#Income__').val();
var TO__ = $('#To__').val();
var TRIP_FINISHING_READING = $('#Trip_Finishing_Reading').val();
var TIME__ = $('#Time__').val();
var DAY_STARTING_READING = $('#Day_Starting_Reading').val();
var DAY_ENDING_READING = $('#Day_Ending_Reading').val();
var OTHER__ = $('#Other__').val();
$.ajax({
url: "https://docs.google.com/forms/d/1iHuOmQx0hXKH6DGb2GNUc-yu-0Iiv9PDkKPgAXX3Ldc/formResponse",
data:{
"entry_383369656": Select_car_from_list,
"entry_1438934548": DRY_RUN_
"entry_2088279404": TRIP_STARTING_READING,
"entry_539691884": FROM__,
"entry_1684801901": DIESEL__,
"entry_226449338": TOLL__,
"entry_1346719937": WATER_BOTTEL_,
"entry_1344884018": TEA__,
"entry_167972598": BREAKFAST__,
"entry_1582005365": LUNCH__,
"entry_1529216536": MAINTAINANCE__,
"entry_1296234561": INCOME__,
"entry_1112513843": TO__,
"entry_450955422": TRIP_FINISHING_READING,
"entry_1631038033": TIME__,
"entry_1729947695": DAY_STARTING_READING,
"entry_2006570865": DAY_ENDING_READING,
"entry_1166627465": OTHER__,
},
type: "POST",
dataType: "xml",
statusCode: {
0: function () {window.location.replace("ThankYou.html");},
200: function () {window.location.replace("ThankYou.html");}
}
});
}
</script>
<script src="http://code.jquery.com/jquery-1.11.0.js"></script>
<script type="text/javascript"></script>
<form action="https://docs.google.com/forms/d/1iHuOmQx0hXKH6DGb2GNUc-yu-0Iiv9PDkKPgAXX3Ldc/formResponse">
<input type="submit" value="GOOGL FORM">
</form>
</body>
</html>
|
|
|
|
|
Hi, did you get it to work? I am struggling 
|
|
|
|
|
<title>
Customised Trips
For customised tours please fill following details we'll get into touch with you, with your desired plan.
Send
function postContactToGoogle() {
var email = $('#Email').val();
var first = $('#First').val();
var last = $('#Last').val();
var company = $('#Company').val();
$.ajax(
{
url: "https://docs.google.com/forms/d/1x6Bqrm33OXyp0OhWFsL-ty0AWMqMKEAs4Can2PI3gzw/formResponse",
data: { "entry.406498363": email,
"entry.1934088081": first,
"entry.934056057": last,
"entry.1375508873": company },
type: "POST",
dataType: "xml",
statusCode: {
0: function () {
window.location.replace("ThankYou.html");
},
200: function () {
window.location.replace("ThankYou.html");
}
}
}
);
}
|
|
|
|
|
I am getting the following error when I tried to post.
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:35054' is therefore not allowed access. The response had HTTP status code 405.
|
|
|
|
|
hi, any solution to this problem ?
|
|
|
|
|
I set this up and the data is being added to my Google form...very cool...but, I am getting CORS errors in Chrome.
XMLHttpRequest cannot load https://docs.google.com/forms/d/.../formResponse. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://mysite.com' is therefore not allowed access.
Should I just ignore since it works? I don't see the error in FF.
Thanks
|
|
|
|
|
Hi Dejan,
In the explanation you said you were looking for the 'name' attribute of the input field. But in the script you use the id attribute value.
Which is to be used?
Thanks,
|
|
|
|
|
Hi there! Great work!
I have only one problem. When I hit submit, I'm directed to googles thankyou page.
Any solutions to how to get it to my page, not google's?
<form action="https://docs.google.com/forms/d/1lJa2yeJ5faTegD7e0AANsFlROTyvL4OunE31ooPOSjM/formResponse" method="POST" id="ss-form" target="_self" onsubmit="">
<h1>Registrer deg</h1>
<h5>Du er nå på steg 1 av 2</h5>
<input type="text" name="entry.705489013" value="" class="ss-q-short tekst" id="entry_705489013" dir="auto" aria-label="Fornavn" title="" placeholder="Fornavn">
<input type="text" name="entry.1365556890" value="" class="ss-q-short tekst" id="entry_1365556890" dir="auto" aria-label="Etternavn" title="" placeholder="Etternavn">
<input type="email" name="entry.201191763" value="" class="ss-q-short tekst" id="entry_201191763" dir="auto" aria-label="Mail Må være en gyldig e-postadresse" title="" placeholder="Mail">
<input type="date" name="entry.1431429884" value="" class="ss-q-date tekst" id="entry_1431429884" dir="auto" aria-label="Fødselsdato" title="" type="datetime-local" name="bdaytime">
<div class="col-xs-6"><input type="radio" name="entry.1071970652" value="Dame" class="ss-q-radio" id="group_1071970652_1" role="radio" dir="auto" aria-label="Mann" title="" ><label class="ss-choice-label">Mann</label></div>
<div class="col-xs-6"><input type="radio" name="entry.1071970652" value="Dame" class="ss-q-radio" id="group_1071970652_2" role="radio" dir="auto" aria-label="Dame" title=""><label class="ss-choice-label">Dame</label></div>
<select name="entry.2108946706" value="" id="entry_2108946706" dir="auto" aria-label="Velg by " class="velgby">
<option class="velgby" value="Haugesund">Haugesund</option>
</select>
<input type="text" name="entry.1694735469" value="" class="ss-q-short tekst" id="entry_1694735469" dir="auto" aria-label="Skole" title="" placeholder="Skriv inn din skole">
<input class="button pull-right" type="submit" name="Register" value="Neste ►" />
</form>
</div>
</div>
<div class="col-md-3"></div>
</div><!--
<script type="text/javascript">
function postContactToGoogle() {
var first = $('#First').val();
var last = $('#Last').val();
var email = $('#Email').val();
var date = $('#Date').val();
var by = $('#By').val();
var sex = $('#Sex').val();
var sex2 = $('#Sex').val();
var skole = $('#Skole').val();
$.ajax({
url: "https://docs.google.com/forms/d/1lJa2yeJ5faTegD7e0AANsFlROTyvL4OunE31ooPOSjM/formResponse",
data: {
"entry_705489013": first,
"entry_1365556890": last,
"entry_201191763": email,
"entry_1431429884": date,
"entry_2108946706": by,
"group_1071970652_1": sex,
"group_1071970652_2": sex2,
"entry_1694735469": skole
},
type: "POST",
dataType: "xml",
statusCode: {
0: function () {
window.location.replace("http://gjermundnor.com");
},
200: function () {
window.location.replace("http://gjermundnor.com");
}
}
});
}
</script>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
|
|
|
|
|
yES - I am also having the same issue
u can have a look -
&&&&&
<script src="http://code.jquery.com/jquery-1.11.0.js"></script>
<script>
function postContactToGoogle() {
var name = $('#name').val();
var dob = $('#dob').val();
var email = $('#email').val();
var address = $('#address').val();
var contactno = $('#contactno').val();
var InputMessage = $('#InputMessage').val();
$.ajax({
url: "https://docs.google.com/forms/d/1TmQ0sG_OAy6yFKJNSM1dXz5lKKDkmNBhA0sjn8ujvhk/formResponse",
data: {
"entry.1442801838": name
"entry.483517062": dob
"entry.81251864": email
"entry.967451853": address
"entry.1998494975": contactno
"entry.44071033": InputMessage },
type: "POST",
dataType: "xml",
statusCode: {
0: function () {
window.location.replace("thank-you.html");
},
200: function () {
window.location.replace("thank-you.html");
}
}
});
}
</script>
Tell me where I am wrong
|
|
|
|
|
|
this could be very useful. thanks.
|
|
|
|
|
While interesting, this article seems to ignore the fact that most people accumulating form data already have extensive tools to analyze it, specifically spreadsheets. Many have add-ins [For example http://www.winstat.com ] for these spreadsheets which can perform extensive statistical analysis such as multiple regression and generate publication ready charts/tables which are easily captured in pdf format using one of the many free virtual pdf printers [for example http://www.cutepdf.com/ ].
It is trivial to assemble a tab delimited quoted data string from the form data, including the textarea and textbox fields, encode this string for safe upload using the encodeURIComponent() JS function [ http://www.w3schools.com/jsref/jsref_encodeuricomponent.asp ], and send this to a simple PHP program to append to a flat data file.
It is also trivial to download this data file using a free FTP program such as Filezilla [ https://filezilla-project.org/download.php ] and import into the spreadsheet or another statistics program such as R.
Why reinvent the wheel? For most of us, the computer/www is a tool to accomplish a task or goal, not an end in itself. Build on what we already know how to do. 
|
|
|
|
|
I have the following code, but nothing happens when i click the submit button. It does not navigate to the thankyou page, nor does it save any data. please help
AJ
|
|
|
|
|
Did you follow all the steps or just copy the code? You have to follow all the steps and change parameters (field names, form URL) accordingly.
|
|
|
|
|