how to pass user input into url

49 views
Skip to first unread message

Ntogg

unread,
Jan 2, 2018, 11:43:54 AM1/2/18
to web...@googlegroups.com
I want to show the user their home address on the google map api that i am using. When the user inputs their address and clicks "submit", I want the google map api to pinpoint their address which I am trying to do by passing the user input into the iframe url of the google maps api. Any idea how I can do that with web2py? (I am very new to Python and web2py)

Dave S

unread,
Jan 19, 2018, 3:34:57 AM1/19/18
to web2py-users


On Tuesday, January 2, 2018 at 8:43:54 AM UTC-8, Ntogg wrote:
I want to show the user their home address on the google map api that i am using. When the user inputs their address and clicks "submit", I want the google map api to pinpoint their address which I am trying to do by passing the user input into the iframe url of the google maps api. Any idea how I can do that with web2py? (I am very new to Python and web2py)

Sorry this got overlooked.  In case you're still wondering, I can mention that the user input can be obtained in various ways, SQLFORM() being one of the easiest. and your controller function would look at request.post_vars.  Assuming the Google Maps API uses values passed in the URL, you would just append the values to the base url.  Something like


# assume the address 123 xyz street,Hollywood,California comes from a form with 4 inputsaddr_sgtr
addr_str = request.post_vars.housenum + " " + request.post_vars.street + "," + request.post_vars.city + "," + request.post_vars.state
IFRAME
(_src='http://www.google.com/maps/api?address=' + addr_str)

(not tested ... I haven't worked with Google APIs, although I saw a demo where GM was used to get the 10 closest Starbucks locations)
/dps


Ntogg

unread,
Feb 2, 2018, 3:34:19 AM2/2/18
to web2py-users
thanks 
Reply all
Reply to author
Forward
0 new messages