We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1061
    • 81 Posts
    I use simple form on first page
    <form action="/[[~2]]" method="post" >
    <input name="query" type="text" id="storelocator-query" value="input your address" class="insearch inputtext" />
    <select name="size">
    <option value="-1">please select</option>
    <option value="10">10</option>
    <option value="20">20</option>
    <option value="30">30</option>
    </select>
    <input type="submit" value="Search"  />
    </form>
    

    that send variables to second page
    <form method="post" action="" id="storelocator-form" onsubmit="storeLocator_getStores(document.getElementById('storelocator-query').value); return false;">
    	Input your address:
    	<input type="text" name="query" value="some_value_that_is_received" id="storelocator-query" />
    	Radius:
    	<select name="radius">
    		<option value="5" >5 km</option>
    		<option value="10" >10 km</option>
    		<option value="25" >25 km</option>
    		<option value="50" selected="selected">50 km</option>
    		<option value="100" >100 km</option>
    	</select>
    	Size:
    	<select size="3" name="size">
    <option value="10">10</option>
    <option value="20">20</option>
    <option value="30">30</option>
    	</select>
    	<input type="button" value="Search" onclick="storeLocator_getStores(document.getElementById('storelocator-query').value);" />
    	<input type="button" value="Clear" onclick="window.location = window.location;" />
    	<input type="hidden" name="longitude" id="storelocator-longitude" />
    	<input type="hidden" name="latitude" id="storelocator-latitude" />
    </form> 
    

    All variables is received, but they doesn't processed by form.
    Results it's awful - nothing is searched and center on google maps is offset.

    What do I need to change in form?

    P.S. Of course on I call [[!StoreLocator? ... ]] with all parameters.
    Standalone second page works fine.
    MODx 2.2.1, StoreLocator 1.1.0 [ed. note: alex_dutch last edited this post 14 years, 5 months ago.]
      • 1061
      • 81 Posts
      I found that I need initialize(onload) javascript function on second page.

      <script type="text/javascript">
      window.onload=storeLocator_getStores(document.getElementById('storelocator-query').value);
      </script>
      </body>


      But I get an error

      Uncaught exception: TypeError: Cannot convert 'storeLocatorGeocoder' to object
      Error thrown at line 37, column 2 in storeLocator_getStores(address) in http://www.mywebsite.com/index.php?id=2:
          storeLocatorGeocoder.geocode({
      called from line 2, column 0 in http://www.mywebsite.com/index.php?id=2:
          window.onload=storeLocator_getStores(document.getElementById('storelocator-query').value);