No, it's a feature! Seriously. When it comes to CFDIV (and other things you can put content in, like the CFWINDOW, etc), Adobe used the following rules:I have a simple question about AJAX, CFDIV and links, I have a little page that uses the CFDIV tag to include a file depending on the selected value in a combobox, currently works great with the BIND attribute, but when the included page in the CFDIV have a cfform and a submit button, the page reloads "inside" the CFDIV and doesnt replace the whole page, how can I make it so it replaces the page? links on the included page in the CFDIV will in fact replace the whole page but the submit buttons of the form, it wont. Is this a bug?
- For forms that use the FORM tag, the post will replace the entire page.
- For forms that use the CFFORM tag, the post will replace just the contents of the div/window/etc.
- Normal HTML links will replace the entire page.
- Links generated via the AjaxLink function will stay inside the div/window/etc.
Comment 1 written by Raul Riera on 31 October 2007, at 3:51 PM
Comment 2 written by Peter Doyle on 31 October 2007, at 4:29 PM
Just a beginners question tbh
Peter
Comment 3 written by Ian on 31 October 2007, at 6:39 PM
Comment 4 written by Gus on 31 October 2007, at 9:01 PM
Comment 5 written by James Edmunds on 1 November 2007, at 8:57 AM
Comment 6 written by Ashwin on 3 November 2007, at 8:32 PM
Comment 7 written by Dave Phipps on 20 December 2007, at 5:00 AM
Then if I click the submit button again the form is submitted but not in the cfdiv and I lose the rest of my page and end up with just the form taking up the whole page.
I'll see if I can create a demo - it may be a quirk somewhere else in my code that is causing to jump out of the cfdiv.
Comment 8 written by Dave Phipps on 20 December 2007, at 5:22 AM
cfdivtest.cfm:
<cfajaximport tags="cfform,cfdiv">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitiona...;
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>CF DIV form test</title>
</head>
<body>
<h1>Cfdiv test</h1>
<p>This text is above the cfdiv</p>
<cfdiv style="clear: both;" id="divtest" bind="url:cfdivform.cfm" />
<p>This text is below the cfdiv</p>
</body>
</html>
cfdivform.cfm:
<cfif isdefined("url.testtext")>
<p>Submitted</p>
<cfoutput><p>#url.testtext#</p></cfoutput>
</cfif>
<cfform name="testfrm" id="testfrm" action="cfdivformresult.cfm" method="post">
<label for="testtext">Enter Text:</label> <cfinput type="text" name="testtext" id="testtext" size="20" maxlength="255" />
<input type="submit" name="submitbtn" id="submitbtn" value="Submit Test" />
</cfform>
cfdivformresult.cfm:
<cflocation url="cfdivform.cfm?testtext=#form.testtext#" addtoken="false" />
Submit the form then submit the form a second time and you will see that the surrounding text disappears.
Is this a bug or a 'feature' and if so how do we fix it? I would rather not have to remove the cflocation which seems to be the culprit.
Comment 9 written by Raymond Camden on 20 December 2007, at 8:20 AM
Or - don't submit at all. Use ColdFusion.Ajax.submitForm() to do it.
Comment 10 written by Dave Phipps on 20 December 2007, at 9:20 AM
Comment 11 written by michael grove on 23 May 2008, at 1:08 AM
I like the idea of staying in the div, but sometimes you just want out.
Comment 12 written by Raymond Camden on 23 May 2008, at 5:39 AM
Comment 13 written by Sinuy on 28 May 2008, at 9:23 AM
form post, ajaxlink() works fine now. but thing is, when i reinit app over this URL http://localhost/index.cfm/reinit/1, the ajaxified area performs INFINITE LOOPS.
do you have face same kind of problem?
Comment 14 written by Raymond Camden on 28 May 2008, at 12:13 PM
[Add Comment] [Subscribe to Comments]