ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 20th, 2004, 10:17 AM
elise_driver elise_driver is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Norwich
Posts: 53 elise_driver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 27 m 10 sec
Reputation Power: 5
Unhappy Writing to text file

Hi,

I have read everything I can find in the cfm book to output from a form into a text file.

The book describes how to do it roughly with the following code;

<cffile action="write" file ="c:\temp\textfile.txt" output ="getlog" addnewline="yes">

I am a bit stuck on how to get the form fields to use this code. How do I input into the file from my form?
Do I use <cfoutput> to dispaly the data once it has been input into the text file?


Thanks

Peter

Reply With Quote
  #2  
Old May 20th, 2004, 12:26 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,700 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 17 h 45 m 21 sec
Reputation Power: 53
Your form fields are available in the form scope. So if you had a field called "firstName", you could use it in the CFFILE tag like this:

<cffile action="write" file ="c:\temp\textfile.txt" output ="#form.firstName#" addnewline="yes">

You read the file using cffile action="read".

I would get a better book, because every CF book I've ever seen covers this in great detail. Even the LiveDocs have examples of this, using form fields no less:

http://livedocs.macromedia.com/cold...7.htm#wp1098395

Reply With Quote
  #3  
Old May 22nd, 2004, 01:33 PM
elise_driver elise_driver is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Norwich
Posts: 53 elise_driver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 27 m 10 sec
Reputation Power: 5
thanks

Very helpful as always. thanks

Reply With Quote
  #4  
Old July 13th, 2004, 01:27 PM
stpieraf stpieraf is offline
Cold Fusion Programmer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 9 stpieraf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
More then a variable..

Is it possible to write more then a variable?

For example, I'd like to be able to have CF write entire Javascripts on the fly to specified files.. Since the scripts are more then one line, writting a single variable for it seems tedious.

Is it possible to dump everything between 2 <cfoutput> tags to a variable? Or somehow write more then 1 line to a file?

Thanks!

Reply With Quote
  #5  
Old July 13th, 2004, 02:55 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,700 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 17 h 45 m 21 sec
Reputation Power: 53
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #6  
Old July 28th, 2004, 08:20 AM
stpieraf stpieraf is offline
Cold Fusion Programmer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 9 stpieraf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks a ton, Kiteless!

Can't belive I never saw that...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Writing to text file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT