How To Submit Using Enter with Multiple Forms on a Single Page
Question:
Integrating with Google Maps and have an issue with the Search Box not submitting when I hit Enter. I know this is because their are two more forms on the page that need to get directions when a person asks for them. However I need to have the top form to submit when I press enter. Or better yet Submit the different form based on what field the cursor is in when the person hits enter.
Code Snippet:
<p>Enter zip code for a store near you <input type=”text” id=”addressInput” name=”addressInput” /> and search within a
<select id=”radiusSelect”>
<option value=”30″ selected>30</option>
<option value=”60″>60</option>
<option value=”120″>120</option>
<option value=”240″>240</option>
</select> mile radius <input type=”button” onclick=”searchLocations()” name=”SearchLocations” value=”Search Locations”/>
</p>
Solution:
Create an “on_submit()” function and submit from there, not from the FORM.
As you move from form to form, set a var accordingly. Then in your new “on_submit()” function, submit the “form” based on your var.













Comments (0)
Trackbacks - Pingbacks (0)
Leave a Reply