Skip to main content
Known Participant
August 9, 2009
Question

cfajax onsubmit self form. please help

  • August 9, 2009
  • 1 reply
  • 1436 views

Hello;

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

I made a page for getting drections to my office. 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 no error, my information still loads, and I still have to scroll down. 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">
/***Combo Menu Load Ajax snippet**/
function ajaxcombo(selectobjID, loadarea){
var selectobj=document.getElementById? document.getElementById(selectobjID) : ""
if (selectobj!="" && selectobj.options[selectobj.selectedIndex].value!="")
ajaxpage(selectobj.options[selectobj.selectedIndex].value, loadarea)
}
</script>

<!--- end loader--->

</head>

<body>

<cfform id="address" name="address" method="post" action="" onsubmit="ajaxcombo('wagmp_directions_1', 'contentarea')" >

<--- 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--->

<div id="contentarea"><div id="wagmp_directions_1"></div></div>
</cfform>

I am doing something wrong here, or this code is not meant to be used like this.

Can anyone help me?

thank you

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    August 9, 2009

    There appears to be a lot more to what you intend to do. There is a fully worked out example in this article on dynamic AJAX content.