Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Feed Select Option in HTML from a Google SpreadSheet

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I'm trying to feed a Selection Option from values in a Google SpreadSheet

So instead of having:



I'm trying to get those values from a Google SpreadSheet and fill up the Selector.

Here is what I'm trying but doesn't seam to work. What I'm doing wrong?

This is the Link to the Google SpreadSheet




Thank you very much for your help
 
Sheriff
Posts: 67636
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That looks like PHP, no?

I've moved this to the PHP forum.
 
samuel marin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I´m trying to do in JavaScript. Just don´t know if it is possible or how to do it.

I´m actually don´t know how to do it in PHP either.

thank you
 
Bear Bibeault
Sheriff
Posts: 67636
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, is that supposed to be PHP or JavaScript in your page at line 13?

What google API is that that you are using? [Edit: found here]

 
samuel marin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried in JavaScript.

It is the JavaScript Google API the one I'm using

<script type="text/javascript" src="https://www.google.com/jsapi"></script>

Thank you very much again
 
Bear Bibeault
Sheriff
Posts: 67636
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's doubtful many people are familiar with that particular API, but we can help you debug it with the usual Javascript debugging techniques. But we need to establish a solid base upon which to being.

Post the code you are trying, without any unnecessary PHP (which just confused the issue), and the exact problems you are having with it. At what point is it not doing what you expect?
 
samuel marin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please find below the Code that I'm using. The body part where the Selector is written works. I can see the selector with Texas on it.

The query works but the part where the info form the query (which is the State of Alabama) should be added to the Selector, that's what is not working.

Thank you very much again


Link to the Google Sheet

 
Bear Bibeault
Sheriff
Posts: 67636
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My guess is that in line 25 you are setting a collection into a context where a scalar is expected and so it's only using the first value.

Just a SWAG.

Set a breakpoint at line 25 and see what dataStates contains.

Why aren't you using jQuery to vastly simplify all of this?

 
samuel marin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm trying to debug through Google Chrome (F12) but not very sure how to run it and see the values. I'm seeing that there is and error in 21 see image attached.

I'm not using jQuery becuase I don't know how to do this in JQuery and also I want to integrate this in Google Site and I don't think I can use jQuery in Google Sites.

Thank you again



Debug.JPG
[Thumbnail for Debug.JPG]
 
Bear Bibeault
Sheriff
Posts: 67636
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, yeah, a JavaScript error is going to stop everything in its tracks.

Where is response defined? What is it supposed to be? You're not being particularly forthcoming with information.
 
samuel marin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,

I tried in a different way to see if it worked. Now I'm able to debug the code and see the info stored in Data. However, I don't understand it and don't know how to use it.

Now I can see in the final result (also attached) that something tried to be added [object Object] but not the value that I tried to add (Value read from the Google Spreadsheet, which is ""Alabama)

Thank you very much again

New Code below as well as Image with the Debug and result of storage of Data attached.


Debug.JPG
[Thumbnail for Debug.JPG]
Debug
FinalResult.JPG
[Thumbnail for FinalResult.JPG]
Final Result
 
samuel marin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I found out a way to use jQuery in Google Sites, so if you could help me out on how to do what I'm trying to do in JQuery that would work as well.

THANK YOU SO MUCH!!!
 
Bear Bibeault
Sheriff
Posts: 67636
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That looks typical of a google internal structure. What does the documentation for the getTableData method have to say about what it returns? I suspect it's not a construct that you are supposed to use directly.

And you never answered my question about jQuery. Life is too short to do DOM manipulation by hand!
 
Quick! Before anybody notices! Cover it up with this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic