close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

do i need to post data to map page first?

Thread began 12/14/2009 2:20 pm by edrosenthal350859 | Last modified 12/16/2009 6:51 pm by Eric Mittman | 1600 views | 7 replies |

edrosenthal350859

do i need to post data to map page first?

i have a dropdown which will, when user selects the values they want, get the proper city and state for a google map.
do i need to submit the page before the map gets the values?

if i submit the map, how do i retain the values the user originally selected on the page?
OR
do i have the dropdowns get values then post action to a different page? rather have it on that page using php self syntax...

if i have the conditional statement then, for testing if the page has been POSTed,
it's then that i'd like to have the map made visible.
sorry for the confused question.

a second question if permitted - the placeholder map exists ok on the development box,
but on the actual server it doesn't show up at all.
what are some of the problems then with that?

Sign in to reply to this post

Eric Mittman

You can have the form with the select lists post to a new page with the map on it or the same page, it does not matter. If you have it post to the same page and you would like to retain the values the user selected you can set the selected value of the dropdown in the property inspector. Just choose the same form element from that form in the bindings when setting the initial value.

If you want to make the map display conditional on values being posted to the page you wrap the map div with an if statement like this:

php:
<?php if($_SERVER["REQUEST_METHOD"] == "POST"){ ?>

   the map div goes here
<?php ?>



As for the problem with the place holder box on the server have you ensured that you have uploaded all of the files for the map? You must make sure that all the files in the google_javascript folder on present on the server. Also, if you are testing locally and have a good result you may need to update your api key for the live server.

Sign in to reply to this post

edrosenthal350859

further discussion re the map

i noticed i was getting the map to display, but suddenly the thing displays the map
in gray but no google map, just the outline, no yellow background, but the shadow of the marker and the zoom bar ok.

in this case i have a user fill out a zip code and there is an ajax call, which sets
the city and state session variables for the map.
earlier this a.m. it seemed to work fine. perhaps i shouldn't eat lunch...

i am attaching the page code, the handler code, the map javascript code.
the url is at rebate.php

the handler for the zip code returns and displays the city and state, and other stuff
from the database.
the sessions are set there and are available for the map.
perhaps you can also point out the travails of having both a post action to the self,
and the ajax call, and if somehow that is interfering with the process...

ok later the problem went away but then i noticed although it had the correct
city and state it doesn't change the map at all. i thought it was going to show a map
of the location i am giving, but instead it has the same map of the last zipcode...
perhaps you can go to the url noted and see if you see what i see?

Attached Files
map-problem.zip
Sign in to reply to this post

Eric Mittman

I can see that the map is not updating with a new value entered. I have checked the code in your wagmp_map_1.php page and I can see that you are setting the values based on session variables. It would seem to me that these session variables are not getting the new values to be set properly and are instead just retaining their earlier values. You should take a look at your script that is setting these session variables and do some testing there to ensure that these variables are getting updated properly with the newly posted info.

Sign in to reply to this post

edrosenthal350859

yes but...

i can see that it will refresh to correct city and state if i hit post, and yes there is something
going on funny there. i will need to reset the variables coming or going.
but beyond that, once the code has seen the new value,
the map doesn't change its location anyway.
but i can see the word "Service" in the map, signalling to me that is a message from Google.
I have a newer version of the files, but i won't send it, but just to say it now has the
zipcode as part of the location factors for the map. State,City, and Zipcode are all being used.
since the map is on the same page, and the calls to get location goes thru the ajax routines,
picking up new values and coming back thru the javascript, how does the map know when
to refresh for new locations? the session variables are dynamic, how does it know they changed?

Sign in to reply to this post

Eric Mittman

The map itself is powered by the code in the wagmp_map_1.php file. This is not an ajax enable app though, if the values in this file are updated the page with the map div on it must be updated to reflect the new values. This is the key though, you must ensure that the new values from this page are being used for the map to show correctly. When the js loads the request are sent to google and the values returned.

Sign in to reply to this post

edrosenthal350859

ok please check the page out

i changed the ajax code to onblur to show that the zip code query to the database is bringing back the data before the submit post action takes place. you can tell what the ajax is doing there. then when the post submit button is pressed the map area is updated with the new city and state, and zip code - all are being reset in the page. however the map does not change location. so how is it that the map knows about the new variables, it is using them in the text on the map itself, but the map does not change its location to the new zip code with the new city and new state locations?
rebate.php
step 1 - enter a zip code and hit tab, the onblur will send the request to the handler and return city and state for the zipcode. you will see below the "Please enter your ZIp Code" the echo from the handler. Then hit the Submit button and you will see the page has taken a refresh, the 4 lines should change and the map below will show "Service:" and then in parens the new City and State. My guess is that the "Service" text here is not yet understood, and is the reason the map doesn't change. But what does that "Service" mean?

Sign in to reply to this post

Eric Mittman

From what I can tell the location that the map is specified to display is not getting it's values updated when the page is submitted or the values are being reset to some default values. Whatever values are present in the wagmp_map_1.php file when the map div is drawn on the page is the location that you will see in the map.

When I view the source code after entering my zip code here is what I see for address 0

var address_0 = {
street: '[Address]',
city: '',
state: '',
zip: '',
country: '',
infowindow: 'default',
infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><strong>Service:</strong><br />(RAMONA, CA)</span>',
full: 'RAMONA,CA',
isdefault: true,
addressType: 'coordinates',
loop: '',
latitude: '',
longitude: '',
markerStyle: 'Google Traditional (flat)',
markerColor: 'Pacifica'
};



So it seems that you are not setting the values that the map needs to show the location.

As for the service text this should be what you see in the custom info window when you create or edit the current map on the page. You can alter this text to be whatever you would like.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...