> Hey guys I have an HTML form where people put in their information. > What I want to happen is this. When they submit the form, have CF write a > html file that looks exactly like the HTML form, except it will have the > data in the fields provided by the submitter.
> Any suggestions as howto approach this... > Note: I tried writing actual HTML in the CFFILE OUTPUT attribute, but CF > couldn't parse that correctly because of tags and quotes in the HTML :( Well... you can do it this way, but you have to escape your quotes with "" or use <cfsavecontent> to create a variable which can then go into your output attribute in your cffile tag... I'm guessing this is for a form which will allow a user to update data which already exists for them in the database? ... In which case I'd recommend not using this approach -- users are apt to type " in their data which break the context of an html tag, whether it's written with <input type="text" value="my"value"> or <cfoutput><input type="text" value="#myvalue#"></cfoutput> ... If you're okay with replacing any of the users double-quotes with something else when the submit the form, then this will work, and I'd recommend just inlining the values with a cfoutput from a dynamic page as above. If you need to keep the double-quotes unmodified, you can use JavaScript ( if it's an option ) to set the values of your form fields after the page loads. There is occasionally a noticeable lag between the page loading and the form values appearing with this method, but it's not usually long enough to allow the user to start entering data before the form values load. I'd recommend the qForms API ( http://www.pengoworks.com ) if you want to go this route -- in combination with <cfwddx action="cfml2js"> it's extremely simple to load up the form this way: <script language="javascript"> function loadMyForm() { <cfwddx action="cfml2js" input="#attributes#" toplevelvariable="attribs"> myform = new qForm("myformname"); myform.setFields(attribs); } window.onload = loadMyForm; </script> Notice that in this example, there's no muddling around with individual form fields -- the entire form is populated in those 3 lines, regardless of how large the form is... Plus qForms gives you some other form manipulation capabilities like required fields, etc. that are pretty nice ( imho much better than the cfform equivalents )... And maybe most importantly it prevents users from double, tripple or quadruple submitting the form, which can create all kinds of havoc. Actually in retrospect -- if this is going onto a server that doesn't have CF on it, you could wrap a <cfsavecontent> around all of this to create a form on the target server that would include all the user's previously entered info -- of course, you'd have to also similarly update the page with the link to the form on it. hth S. Isaac Dealey Certified Advanced ColdFusion 5 Developer www.turnkey.to 954-776-0046 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

