Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / General CF Topics / January 2008



Tip: Looking for answers? Try searching our database.

How to POST FORM within CFWINDOW?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fernis - 01 Dec 2007 21:01 GMT
Can anyone point me to the right track, since I have difficulties learning the
new AJAX UI things...

I'm trying to submit a form which is located in a CFWINDOW popup. Whenever I
hit the submit button, I get a CF debug error: "error: http: Error retrieving
markup for element Window1_body : Not Found". The popup content reloads with
the HTTP server's 404 not found message.  I'm running CF8 and IIS 7 on Windows
Server 2003.

I must be doing something fundamentally very wrong, right?
-

<cfwindow name="window1" title="CFML Window" draggable="false"
        resizable="false" initshow="true" height="250" width="250" x=375 y=0>
   
        <cfform name="projectform" action="test.cfm" method="post">
    Project name: <cfinput type="text" name="projectname">
    <br>
    <cfinput type="hidden" name="action" value="createnew">
    <cfinput type="submit" value="create" name="mysubmitbutton">
    </cfform>
   
</cfwindow>
coffeedrinker56 - 03 Dec 2007 01:40 GMT
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=..." />
Fernis - 03 Dec 2007 03:01 GMT
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.
cfjedimaster - 02 Jan 2008 23:26 GMT
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=..." />
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.