I am working on an issue where we need to update a customer's address. When you change the city, state, or zip, a message is fires that says "Do you want to change the city from priorCity to currentCity". If the current city. This is working correctly, however, if the field is initially blank, or if you remove the listed city, confirm that changing it to blank is OK, then type in a fresh city name, the message fires and it is not supposed to.
I tried changing the if statement from if (priorCity != currentCity)
length != 0) && priorCity != currentCity)
then loaded my test server, the city was set to "Phoenix" I erased it and pressed tab, the message fired. Good. Then I typed in a new city name and the message didn't fire, which is what I want, but then I changed THAT city to something else, and the message doesn't fire at all anymore. It's still thinking the length of the field is 0.
from the jsp I have -
from the js i have -
if (zipLookupDone == "true")
var priorCity = contactInformationForm.elements[priorCityField].value;
var currentCity = contactInformationForm.elements[cityField].value;
if (priorCity != currentCity)
if (!confirm("Should the city be changed from " + priorCity + " to " + currentCity + "?"))
contactInformationForm.elements[cityField].value = priorCity;
contactInformationForm.elements[priorCityField].value = currentCity;