RE: Pre-populating a "file" form field
Hi, Having hashed through the security issues on the list already, I believe that your only option for making this work would be to implement your app as an HTA. This, of course, limits you to support for the IE browser only. Additionally, use of HTA's probably aren't acceptable outside of an Intranet or private application anyway. Geoff B > -Original Message- > From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 02, 2003 10:37 AM > To: CF-Talk > Subject: Pre-populating a "file" form field > > > I have an application that starts with a form. When a user fills out the > form and clicks submit, the data is sent to the server and validated. If > the user has submitted something in error (a date, or a missing required > field), the form is re-displayed and populated with the users original > choices - along with a message telling them what to correct. > It's the sort > of code I'm sure we have all written in our sleep. > > One of the fields is a "file" field however. When I try to "pre-populate" > that field with the original user choice, it fails. I'm sure this is > because of the special nature of the file field, and I've told my client > that I do not believe it can be done. Does anyone know of a trick to > re-fill the file field with the users original choice? > > -Mark > > > ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
RE: Pre-populating a "file" form field
got ya. will -Original Message- From: Timothy Heald [mailto:[EMAIL PROTECTED]] Sent: 02 January 2003 16:24 To: CF-Talk Subject: RE: Pre-populating a "file" form field It has a value, but you can't set the value, only read it. So you can write a script to say check file types, but not one to automatically fill in the information (path) about a specific file. It's a security feature. Tim -Original Message- From: Will Swain [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 11:21 AM To: CF-Talk Subject: RE: Pre-populating a "file" form field but according to this (http://www.blooberry.com/indexdot/html/tagpages/i/inputfile.htm) it does have a value attribute, and also a readonly attribute. will -Original Message- From: Boardwine, David L. [mailto:[EMAIL PROTECTED]] Sent: 02 January 2003 16:07 To: CF-Talk Subject: RE: Pre-populating a "file" form field The problem is the INPUT TYPE="File" has no value attribute. Therefore there is no way to re-populate it. DavidB -Original Message- From: Gyrus [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 10:58 AM To: CF-Talk Subject: Re: Pre-populating a "file" form field - Original Message - > One of the fields is a "file" field however. When I try to "pre-populate" > that field with the original user choice, it fails. I'm sure this is > because of the special nature of the file field, and I've told my client > that I do not believe it can be done. Does anyone know of a trick to > re-fill the file field with the users original choice? --- I've never had a client complain about this, ergo I've never thought about it before ;-) But yeah, I've noticed it in passing, and thinking about it now, the only thing that comes to mind is: - onsubmit, copy the file field's value into a hidden field with JS - Use this hidden field to re-populate the file field Haven't tried it, but can't see why it wouldn't work. Gyrus [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://norlonto.net PGP key available ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com
RE: Pre-populating a "file" form field
Will, Yes, but look further. in the paragraph below it says: Internet Explorer, Netscape and Opera do not use the VALUE attribute as the default contents of the input area. Any default value set via HTML is not usable via scripting and the DOM as well (hence it is not listed as 'supported' in any of the browsers.) If a user enters text in the field however, that value is then reachable via the DOM as it normally would be for a normal INPUT field (via the .value property.) The reason for this behavior would presumably be to ensure the security/safety of users against malicious authors. --- -Original Message- From: Will Swain [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 10:21 AM To: CF-Talk Subject: RE: Pre-populating a "file" form field but according to this (http://www.blooberry.com/indexdot/html/tagpages/i/inputfile.htm) it does have a value attribute, and also a readonly attribute. will -Original Message- From: Boardwine, David L. [mailto:[EMAIL PROTECTED]] Sent: 02 January 2003 16:07 To: CF-Talk Subject: RE: Pre-populating a "file" form field The problem is the INPUT TYPE="File" has no value attribute. Therefore there is no way to re-populate it. DavidB -Original Message- From: Gyrus [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 10:58 AM To: CF-Talk Subject: Re: Pre-populating a "file" form field - Original Message - > One of the fields is a "file" field however. When I try to "pre-populate" > that field with the original user choice, it fails. I'm sure this is > because of the special nature of the file field, and I've told my client > that I do not believe it can be done. Does anyone know of a trick to > re-fill the file field with the users original choice? --- I've never had a client complain about this, ergo I've never thought about it before ;-) But yeah, I've noticed it in passing, and thinking about it now, the only thing that comes to mind is: - onsubmit, copy the file field's value into a hidden field with JS - Use this hidden field to re-populate the file field Haven't tried it, but can't see why it wouldn't work. Gyrus [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://norlonto.net PGP key available ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
RE: Pre-populating a "file" form field
Also on the same page: "Internet Explorer, Netscape and Opera do not use the VALUE attribute as the default contents of the input area. Any default value set via HTML is not usable via scripting and the DOM as well (hence it is not listed as 'supported' in any of the browsers.) If a user enters text in the field however, that value is then reachable via the DOM as it normally would be for a normal INPUT field (via the .value property.) The reason for this behavior would presumably be to ensure the security/safety of users against malicious authors" HTH Kola >> -Original Message- >> From: Will Swain [mailto:[EMAIL PROTECTED]] >> Sent: 02 January 2003 16:21 >> To: CF-Talk >> Subject: RE: Pre-populating a "file" form field >> >> but according to this >> (http://www.blooberry.com/indexdot/html/tagpages/i/inputfile.htm) it does >> have a value attribute, and also a readonly attribute. >> >> will >> >> -Original Message- >> From: Boardwine, David L. [mailto:[EMAIL PROTECTED]] >> Sent: 02 January 2003 16:07 >> To: CF-Talk >> Subject: RE: Pre-populating a "file" form field >> >> >> The problem is the INPUT TYPE="File" has no value attribute. Therefore >> there >> is no way to re-populate it. >> >> DavidB >> >> -Original Message- >> From: Gyrus [mailto:[EMAIL PROTECTED]] >> Sent: Thursday, January 02, 2003 10:58 AM >> To: CF-Talk >> Subject: Re: Pre-populating a "file" form field >> >> >> - Original Message - >> > One of the fields is a "file" field however. When I try to "pre- >> populate" >> > that field with the original user choice, it fails. I'm sure this is >> > because of the special nature of the file field, and I've told my >> client >> > that I do not believe it can be done. Does anyone know of a trick to >> > re-fill the file field with the users original choice? >> --- >> >> I've never had a client complain about this, ergo I've never thought >> about >> it before ;-) But yeah, I've noticed it in passing, and thinking about >> it >> now, the only thing that comes to mind is: >> >> - onsubmit, copy the file field's value into a hidden field with JS >> - Use this hidden field to re-populate the file field >> >> Haven't tried it, but can't see why it wouldn't work. >> >> Gyrus >> [EMAIL PROTECTED] >> work: http://www.tengai.co.uk >> play: http://norlonto.net >> PGP key available >> >> >> >> ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
RE: Pre-populating a "file" form field
Thanks to all who responded. As I suspected, the consensis is that it cannot be done for security implementation reasons. It always helps to have some follks back you up . -Mark -Original Message- From: Boardwine, David L. [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 10:07 AM To: CF-Talk Subject: RE: Pre-populating a "file" form field The problem is the INPUT TYPE="File" has no value attribute. Therefore there is no way to re-populate it. DavidB -Original Message- From: Gyrus [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 10:58 AM To: CF-Talk Subject: Re: Pre-populating a "file" form field - Original Message - > One of the fields is a "file" field however. When I try to "pre-populate" > that field with the original user choice, it fails. I'm sure this is > because of the special nature of the file field, and I've told my client > that I do not believe it can be done. Does anyone know of a trick to > re-fill the file field with the users original choice? --- I've never had a client complain about this, ergo I've never thought about it before ;-) But yeah, I've noticed it in passing, and thinking about it now, the only thing that comes to mind is: - onsubmit, copy the file field's value into a hidden field with JS - Use this hidden field to re-populate the file field Haven't tried it, but can't see why it wouldn't work. Gyrus [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://norlonto.net PGP key available ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 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
RE: Pre-populating a "file" form field
what about just using a textfield with the value basically to mimic a file field. so when submitted, if they want to change it, use dhtml to change/show a file field. not the prettiest thing, but could work i guess. -Original Message- From: Massimo, Tiziana e Federica [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 11:12 AM To: CF-Talk Subject: Re: Pre-populating a "file" form field > I've never had a client complain about this, ergo I've never thought about > it before ;-) But yeah, I've noticed it in passing, and thinking about it > now, the only thing that comes to mind is: > > - onsubmit, copy the file field's value into a hidden field with JS > - Use this hidden field to re-populate the file field > > Haven't tried it, but can't see why it wouldn't work. It doesn't works because, for security reasons, the value of a file field can't be set, neither from HTML or JavaScript Massimo ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.
RE: Pre-populating a "file" form field
It has a value, but you can't set the value, only read it. So you can write a script to say check file types, but not one to automatically fill in the information (path) about a specific file. It's a security feature. Tim -Original Message- From: Will Swain [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 11:21 AM To: CF-Talk Subject: RE: Pre-populating a "file" form field but according to this (http://www.blooberry.com/indexdot/html/tagpages/i/inputfile.htm) it does have a value attribute, and also a readonly attribute. will -Original Message- From: Boardwine, David L. [mailto:[EMAIL PROTECTED]] Sent: 02 January 2003 16:07 To: CF-Talk Subject: RE: Pre-populating a "file" form field The problem is the INPUT TYPE="File" has no value attribute. Therefore there is no way to re-populate it. DavidB -Original Message- From: Gyrus [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 10:58 AM To: CF-Talk Subject: Re: Pre-populating a "file" form field - Original Message - > One of the fields is a "file" field however. When I try to "pre-populate" > that field with the original user choice, it fails. I'm sure this is > because of the special nature of the file field, and I've told my client > that I do not believe it can be done. Does anyone know of a trick to > re-fill the file field with the users original choice? --- I've never had a client complain about this, ergo I've never thought about it before ;-) But yeah, I've noticed it in passing, and thinking about it now, the only thing that comes to mind is: - onsubmit, copy the file field's value into a hidden field with JS - Use this hidden field to re-populate the file field Haven't tried it, but can't see why it wouldn't work. Gyrus [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://norlonto.net PGP key available ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
Re: Pre-populating a "file" form field
> but according to this > (http://www.blooberry.com/indexdot/html/tagpages/i/inputfile.htm) it does > have a value attribute, and also a readonly attribute. Yes, it has a value attribute that can be read with JavaScript, but it's read-only (and I am glad it is!) Massimo ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
RE: Pre-populating a "file" form field
but according to this (http://www.blooberry.com/indexdot/html/tagpages/i/inputfile.htm) it does have a value attribute, and also a readonly attribute. will -Original Message- From: Boardwine, David L. [mailto:[EMAIL PROTECTED]] Sent: 02 January 2003 16:07 To: CF-Talk Subject: RE: Pre-populating a "file" form field The problem is the INPUT TYPE="File" has no value attribute. Therefore there is no way to re-populate it. DavidB -Original Message- From: Gyrus [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 10:58 AM To: CF-Talk Subject: Re: Pre-populating a "file" form field - Original Message - > One of the fields is a "file" field however. When I try to "pre-populate" > that field with the original user choice, it fails. I'm sure this is > because of the special nature of the file field, and I've told my client > that I do not believe it can be done. Does anyone know of a trick to > re-fill the file field with the users original choice? --- I've never had a client complain about this, ergo I've never thought about it before ;-) But yeah, I've noticed it in passing, and thinking about it now, the only thing that comes to mind is: - onsubmit, copy the file field's value into a hidden field with JS - Use this hidden field to re-populate the file field Haven't tried it, but can't see why it wouldn't work. Gyrus [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://norlonto.net PGP key available ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
RE: Pre-populating a "file" form field
The problem is the INPUT TYPE="File" has no value attribute. Therefore there is no way to re-populate it. DavidB -Original Message- From: Gyrus [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 10:58 AM To: CF-Talk Subject: Re: Pre-populating a "file" form field - Original Message - > One of the fields is a "file" field however. When I try to "pre-populate" > that field with the original user choice, it fails. I'm sure this is > because of the special nature of the file field, and I've told my client > that I do not believe it can be done. Does anyone know of a trick to > re-fill the file field with the users original choice? --- I've never had a client complain about this, ergo I've never thought about it before ;-) But yeah, I've noticed it in passing, and thinking about it now, the only thing that comes to mind is: - onsubmit, copy the file field's value into a hidden field with JS - Use this hidden field to re-populate the file field Haven't tried it, but can't see why it wouldn't work. Gyrus [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://norlonto.net PGP key available ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 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
Re: Pre-populating a "file" form field
> I've never had a client complain about this, ergo I've never thought about > it before ;-) But yeah, I've noticed it in passing, and thinking about it > now, the only thing that comes to mind is: > > - onsubmit, copy the file field's value into a hidden field with JS > - Use this hidden field to re-populate the file field > > Haven't tried it, but can't see why it wouldn't work. It doesn't works because, for security reasons, the value of a file field can't be set, neither from HTML or JavaScript Massimo ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 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
Re: Pre-populating a "file" form field
Mark By any chance do you have clientmanagementenabled on application and is it MX? I cannot get any forms to be repopulated as we are all used to IF clientmanagememt is enabled in MX. Can't do the cf validation routines either: (ThisField_required, thisField_date, etc.) as when user goes back all is lost! If clientmanagement is NOT enabled, it all works as we are used to. E. Keith Dodd Wings of Eagles Services www.wingserv.com - Original Message - From: "Mark A. Kruger - CFG" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Thursday, January 02, 2003 10:36 AM Subject: Pre-populating a "file" form field > I have an application that starts with a form. When a user fills out the > form and clicks submit, the data is sent to the server and validated. If > the user has submitted something in error (a date, or a missing required > field), the form is re-displayed and populated with the users original > choices - along with a message telling them what to correct. It's the sort > of code I'm sure we have all written in our sleep. > > One of the fields is a "file" field however. When I try to "pre-populate" > that field with the original user choice, it fails. I'm sure this is > because of the special nature of the file field, and I've told my client > that I do not believe it can be done. Does anyone know of a trick to > re-fill the file field with the users original choice? > > -Mark > > > ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
Re: Pre-populating a "file" form field
- Original Message - > One of the fields is a "file" field however. When I try to "pre-populate" > that field with the original user choice, it fails. I'm sure this is > because of the special nature of the file field, and I've told my client > that I do not believe it can be done. Does anyone know of a trick to > re-fill the file field with the users original choice? --- I've never had a client complain about this, ergo I've never thought about it before ;-) But yeah, I've noticed it in passing, and thinking about it now, the only thing that comes to mind is: - onsubmit, copy the file field's value into a hidden field with JS - Use this hidden field to re-populate the file field Haven't tried it, but can't see why it wouldn't work. Gyrus [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://norlonto.net PGP key available ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 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
RE: Pre-populating a "file" form field
Hi Mark, I was faced with something similar. It cannot be done. This is by design, otherwise rogue websites could force you to upload a file (if they knew the path/filename). See the following for more info. http://www.blooberry.com/indexdot/html/tagpages/i/inputfile.htm http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_FILE.html HTH DavidB -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 02, 2003 10:37 AM To: CF-Talk Subject: Pre-populating a "file" form field I have an application that starts with a form. When a user fills out the form and clicks submit, the data is sent to the server and validated. If the user has submitted something in error (a date, or a missing required field), the form is re-displayed and populated with the users original choices - along with a message telling them what to correct. It's the sort of code I'm sure we have all written in our sleep. One of the fields is a "file" field however. When I try to "pre-populate" that field with the original user choice, it fails. I'm sure this is because of the special nature of the file field, and I've told my client that I do not believe it can be done. Does anyone know of a trick to re-fill the file field with the users original choice? -Mark ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm