Hey Brian, Maybe it's as easy as g_place = self.request.POST.get('place') instead of g_place = self.request.get('place')
Cheers Niklas Stockholm On Jan 4, 11:18 am, thebrianschott <schott.br...@gmail.com> wrote: > Having received no replies, let me say a little more. > > If I add the following line into the beginning of function process > (form), > the POST does successfully POST the value of place, but the > values of all the other hidden form inputs are *not* POSTED. And > I cannot add lines like the following one for the other hidden form > inputs because they are not known and must be taken from the > user's map settings. > > form.place.value = String({{place|addslashes}}); > > Perhaps I should have included the following html code in the original > posting, too. (The map is dragged about --recentered-- and zoomed > by the user, so these initial settings are revised before the form > is POSTed). > > *******************more relevant html code below****************** > var map = new GMap2(document.getElementById("map"), > {draggableCursor:"default"}); > map.addControl(new GLargeMapControl()); > map.setCenter(new GLatLng(24.21,-41.48), 2); > *******************more relevant html code above****************** > > Here is another critical piece of information. If I replace the > following > line in process(form) with the second line below, I still get an > error > message that center_lat is an empty string. So it appears that the > POST method is not working the way I have it constructed. > > form.center_lat.value = String(map.getCenter().lat()); > form.center_lat.value = String(34); > > Please help with this POST problem. > > Brian in Atlanta > > On Jan 2, 9:03 am, thebrianschott <schott.br...@gmail.com> wrote: > > > I cannot retrieve the value of the variable "g_place" in the following > > python script back from "add_place.html". "g_place" is effectively > > sent to "add_place.html" in the "def get(self)" section of class > > AddPlace, but "g_place" is not returned to the python script in the > > "def post(self)" section of class AddPlace. "g_place" is sent to > > "add_place.html" and placed in the var "iwform" with the phrase > > {{place|escape}}. > > > (I hope I have provided enough information. I am reluctant to upload > > this buggy version to GAE, so I cannot just provide a link. Please > > advise if there is another protocol/procedure I should be using to > > provide the code as a link.) > > > Thanks, > > > Brian in Atlanta > > > *******************relevant python code below****************** > > class MainPage(webapp.RequestHandler): > > def get(self): > > place_id = self.request.get("place", None) > > > place= Group(key_name=place_id) > > place.place = place_id > > place.user = user > > place.put() > > key = db.Key.from_path("Group", place_id) > > path = os.path.join(os.path.dirname(__file__), > > 'add_place.html') > > template_values = dict(place_id=place.key(), > > place=place.place) > > self.response.out.write(template.render(path, > > template_values)) > > > class AddPlace(webapp.RequestHandler): > > #creates blank template_values > > def get(self): > > g_place = self.request.get('place') > > user = users.get_current_user() > > param = 'add_place.html' > > path = os.path.join(os.path.dirname(__file__), param) > > template_values = dict(place=g_place) > > self.response.out.write(template.render(path, > > template_values)) > > > #creates initial group attribute values > > def post(self): > > g_place = self.request.get('place') > > group= Group(key_name=g_place) > > group.place = g_place > > group.center_lat = float(self.request.get('center_lat')) > > group.center_lng = float(self.request.get('center_lng')) > > group.zoom = int(self.request.get('zoom')) > > group.put() > > self.redirect("/?place=%s" % g_place) > > > application = webapp.WSGIApplication( > > [('/', MainPage), > > ('/details.txt', Details), > > ('/add_place', AddPlace)], > > debug=True) > > *******************relevant python code above****************** > > > *******************relevant html code below****************** > > var lastmarker; > > var myEventListener; > > > var iwform = 'Enter your group\'s information:<br>' > > + '<form method="POST" onsubmit="return process(this)" > > action="add_place">' > > + 'Group Name or Initials: ' > > + '<br />' > > + '<strong>{{place|escape}}</strong>' > > + '<br />' > > + ' <input type="hidden" name="place" value="{{place| > > addslashes}}"/>' > > + ' <input type="hidden" name="center_lat"/>' > > + ' <input type="hidden" name="center_lng"/>' > > + ' <input type="hidden" name="zoom"/>' > > + ' <input type="submit" value="Submit" />' > > + '<\/form>'; > > > function process(form) { > > // == populate map data > > form.center_lat.value = String(map.getCenter().lat()); > > form.center_lng.value = String(map.getCenter().lng()); > > form.zoom.value = String(map.getZoom()); > > lastmarker.closeInfoWindow(); > > GEvent.removeListener(myEventListener); > > > return true; > > } > > *******************relevant html code above****************** --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---