0 Replies Latest reply on Aug 7, 2009 8:17 PM by cfsetNewbie

    cfajax text load using a form. please help

    cfsetNewbie

      Hello;

      I am trying to make a small app that works as follows.

       

      I am making a page for getting drections to my house. I have it tied into google maps. The whole thing works really well. I have one issue. When you hit submit on the form with your departure address, the whole page loads and you have to scroll down to the bottom to get the directions.

       

      I want it to load on the directions it's self. So I am trying to use this ajax loading code I have. As of right now, the way it is set up, I get an object error, but my information still loads, just get an error and have to scroll down still. Can anyone help me fix this code OR tell me a better way to accomplish this. I have limited options as anyone knows who has programmed google maps into a web site.

       

      This is my code, as it is set up.

       

      <head>

      <!--- Ajax loader --->
      <script type='text/javascript' src='/scripts/engine.js'></script>
        <script type='text/javascript' src='/scripts/util.js'></script>
        <script type='text/javascript' src='/scripts/settings.js'></script>
        <script language="javascript">
         function loadInfo()
         {
          var address = DWRUtil.getValue("address");
          DWREngine._execute(_cfscriptLocation, null, 'addressinfo', address, getResult);
         }
        
         function getResult(result)
         {
          document.getElementById("info").innerHTML = result;
         }

         function init()
         {
          DWRUtil.useLoadingMessage();
          DWREngine._errorHandler =  errorHandler;
          loadInfo();
         }
        </script>
      <!--- end loader--->

      </head>

      <body onLoad="<!--- in this spot, I am also preloading images!--->;init()">

      <cfform id="address" name="address" method="post" action="" onsubmit="loadinfo()">

      <--- here are my form filds --->

       

      <!--- This is my map, it has to be in the form tags --->

      <div id="wagmp_map_1" style="width: 400px; height: 400px;"></div>

      <!--- this span is part of the ajax loader--->

      <span name="info" id="info" style="padding-left:4px; padding-right:4px;"><!--- this is the directions that gets loaded after submitting the form---><div id="wagmp_directions_1"></div></span>
      </cfform>

       

       

      The java files are fine, I don't need to change anything on those. I am doing something wrong here, or this code is not meant to be used like this.

       

      Can anyone help me?

      thank you