Your form needs to be in a valid XHTML format for CF to read it. That includes everything from the <html> tag right down to the </html>... including closing your input tags: <input type=..." />
Thanks, that advice helped quite a bit. Got my forms working now within a CFDIV
or CFWINDOW.
However, I haven't been able to use <cfinput type="submit"> - that always
gives me the 404 error despite of what I try. As I'm a total beginner with
advanced AJAX UI features, I don't know if it should even work. But using
<cfinput type="button" onclick="ColdFusion.navigate.... works fine, and gets
the same job done.
<html>
<head>
<script language="javascript">
var mycallBack = function(){}
var myerrorHandler = function(errorCode,errorMessage){ alert("[In Error
Handler]" + "\n\n" + "Error Code: " + errorCode + "\n\n" + "Error Message: " +
errorMessage);}
</script>
</head>
<body>
<cfwindow name="window1" title="CFML Window" draggable="false"
resizable="false" initshow="true" height="250" width="250" x=375 y=0>
<html><body>
<cfform name="projectform" action="formpost.cfm" method="post"
target="window1">
Project name: <cfinput type="text" name="projectname"><br>
<cfinput type="hidden" name="action" value="createnew">
<cfinput type="button" value="Create" name="mysubmitbutton"
onClick="ColdFusion.navigate('formpost.cfm','window1',mycallBack,myerrorHandler,
'POST','projectform');">
<!--- commenting the line above and uncommenting the line below doesn't work
--->
<!--- <cfinput type="submit" value="Create" name="mysubmitbutton">--->
</cfform>
</body></html>
</cfwindow>
</body>
</html>
--
file: formpost.cfm - this just contains one line of text, to verify the form
was posted.
Azadi - 03 Dec 2007 06:36 GMT
not sure if it is related to your issue or not, but you do not really
need the target="window1" in your cfform tag: cfform will by default
submit to and display results page in the container it is displayed in,
while if you were to use reguler <form> tag instead, it would submit to
(and thus replace) the parent page.
---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Fernis - 03 Dec 2007 10:24 GMT
You are absolutely right. That attribute was left in the code by accident, as I
was evaluating all different, even desperate tricks. Unfortunately removing the
attribute doesn't make it work with the submit-type field. Even the <html> and
<body> tags within cfwindow are extraneous - I think, but removing those won't
make a difference either.
Fernis - 03 Dec 2007 19:49 GMT
Solved the issue.
In an asynchronously posted form (or a cfform in general) you can't have a
form field the name of which is "action". This is probably a reserved CF
keyword, and the reason why it shouldn't be used... I don't know but that's
gotta be the case.
This is surely something that can be hard to remember, since I have been
writing thousands of hidden "action" fields in forms within the past 15 years.
CF does not require valid XHTML for any HTML tags. Some CF tags require an
end tag, but not all.
>Your form needs to be in a valid XHTML format for CF to read it. That includes everything from the <html> tag right down to the </html>... including closing your input tags: <input type=..." />