sepoto Posted July 1, 2011 Share Posted July 1, 2011 <form id="addressForm" action="/" style='text-align: left;'> <div style=''> <div style='text-align: left;'> <label for="address">Address:</label><Br> <input type="text" name="address" id="address" style='width: 300px;' /><br> <label for="radius">Radius:</label><br> <select name="Radius" size="1" style='width: 300px;'> <option value="5" selected>5</option> <option value="10">10</option> <option value="50">50</option> </select><br></div> <input type="submit" id="addressButton" value="Get Bars" /> </div> </form> In my header I have this: form.onsubmit = function() { // Getting the address from the text input var address = document.getElementById('address').value; var dist = document.getElementById('dropdown').value // Making the Geocoder call getCoordinates(address); // Preventing the form from doing a page submit return false; } With action="/" the form used to work perfectly. I was busy making some modifications inside getCoordinates(address); when I noticed the Get Bars button no longer did what it was supposed to and started redirecting me to some other page. I don't know how to fix this. Does anyone know what might be happening?Thank you Link to comment Share on other sites More sharing options...
justsomeguy Posted July 1, 2011 Share Posted July 1, 2011 Check for errors in the getCoordinates function. If there's an error there, the other function will not return false to cancel the submit. The action doesn't matter, you can leave it out. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.