Link to home
Start Free TrialLog in
Avatar of Matt Grofsky
Matt GrofskyFlag for United States of America

asked on

ColdFusion.navigate Refreshing Page

I'm running the following code jsut as a simple example to get something working.
My SearchRecords.cfm page simple has the text 'test' on it.

When the submit button is pushed 'test' appears briefly and then vanishes as if the page reloaded again.

Any idea what I'm doing wrong?  I was under the assumption that the page being posted to would return its value to the CFDIV permanently and not just briefly.
<cfajaximport>
 
<script language="javascript">
<!--- The error handler pops an alert with the error code and message. --->
var myerrorhandler = function(errorCode,errorMessage){
alert("[In Error Handler]" + "\n\n" + "Error Code: " + errorCode + "\n\n" + "Error Message: " + errorMessage);
} 
</script>
 
<cfform name="auto" id="auto">
<INPUT NAME="Get Data" TYPE="submit" VALUE="Get Data" onclick="javascript:ColdFusion.navigate('SearchRecords.cfm','outputPage','',myerrorhandler,'POST','auto');" />
</cfform>
 
<cfdiv id="outputPage"/>

Open in new window

Avatar of gdemaria
gdemaria
Flag of United States of America image

I believe you're combinging a couple things that you don't need to.

 Coldfusion.navigate will navigate the URL into the DIV

 But Submit will submit a form within the div without refreshing the page.

 What is your goal to submit the form or to just change the div when clicking a button?
Avatar of Matt Grofsky

ASKER

both, submit the form to a page and display the result in the div
If you place the form inside the CFDIV and get rid of the navigate function, by default the form submit will submit and redraw only the contents of the CFDIV.  You don't need both.
Will the form still be present? Or will it be replaced by the returned value?

My goal is to update a part of the page where the form isn't placed
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That indeed was it, thanks for the help!