Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using CFHTTP to submit a form directly to a google docs form

New Here ,
Sep 19, 2009 Sep 19, 2009

Ok so here is some background

Google has a service where you can create forms using google docs and embed them into your webpage, Results are automatically stored in a google spreadsheet upon submission.

I want to use my own form to submit to to the google form processing page which I can get to work however the default generic google hosted thank you page appears upon submissing.

I know you can use cfhttp to submit a form from a coldfusion server so I was thinking that I could simply pass my form variables to a action page that resubmitted them via cfhttp and thus bypass the thank you page altogether

however when I try this it does not work and the results do not show up in the google spreadsheet. I figured that mabye the google processing page could tell that it was not submitted from a browser so I tired adding a useragent string but still no luck.

Here is the code I was trying to use

<cfhttp method="POST" url="https://spreadsheets.google.com/formResponse?key=tlo4FjygqMuUGmvuOb2_Gjw" redirect="yes" useragent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)">
 
     <cfhttpparam type="Formfield" name="entry.0.single" value="testValue1" >
     <cfhttpparam type="Formfield" name="entry.1.single" value="testValue2" >
     
</cfhttp>

And the online spread sheet can be viewed here


http://spreadsheets.google.com/pub?key=tlo4FjygqMuUGmvuOb2_Gjw&single=true&gid=0 &output=html

Does anyone know why this is not working?

To recap I am able to use the following form on my own comptuer to directly submit to the processing page and this works

<form action="https://spreadsheets.google.com/formResponse?key=tlo4FjygqMuUGmvuOb2_Gjw" method="POST">
<input type="text" name="entry.0.single" value="" >
<input type="text" name="entry.1.single" value="">
<input type="submit" name="submit" value="Submit">
</form>

Any help would be greatly appreciated

1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 19, 2009 Sep 19, 2009

What if you also include the submit field as cfhttpparam?

Translate
Community Expert ,
Sep 19, 2009 Sep 19, 2009

What if you also include the submit field as cfhttpparam?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 19, 2009 Sep 19, 2009

YES!!!!!!!!!!!!!!!!!!!!!! This did it final code is as follows thanks for you help

<cfhttp method="POST" url="https://spreadsheets.google.com/formResponse?key=tlo4FjygqMuUGmvuOb2_Gjw" useragent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)">
 
     <cfhttpparam type="Formfield" name="entry.0.single" value="final test">
     <cfhttpparam type="Formfield" name="entry.1.single" value="final test">
      <cfhttpparam type="Formfield" name="submit" value="Submit">

</cfhttp>

Man this is great! and has eliminated half my database requirements! now only if you could pull the results back out!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2009 Sep 19, 2009

A point of etiquette. Yes-but reactions can give the impression your question hasn't been answered, or that you're ungrateful. Please, first kindly acknowledge what helps.

It's nice, but not enough to thank me. Say what it is that you thank me for. That is what those who come here looking for an answer to a similar question would want to know. Only then, should you proceed to the next question.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 19, 2009 Sep 19, 2009
LATEST

  opps sorry I did not mean to sound ungrateful I am defiantly thankfull.. I marked your reply as the correct answer and started  the post  with a thanks. I was not asking another question merely stating that I would be great if one could now pull the data out of google spreadsheets, incidentally it looks like you can as google publishes the spreadsheet in xml format http://spreadsheets.google.com/feeds/list/<spread sheet key here>/od6/public/basic.  But your point is taken. Thanks again for your assistance

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources