Solved

input type file prob

Posted on 2004-04-04
9
132 Views
Last Modified: 2013-12-24
Ok i have an edit page..
its like this.. it reads a Y/N value from a database.. and poplates the checkbox as such..
next to it is a file upload.. which i want to work only if the user clicks it..

so basically how do i check whether anything is in the input file tage.. so i can upload a file if it doesnt exist..

0
Comment
Question by:chizzy60
  • 4
9 Comments
 
LVL 17

Expert Comment

by:Tacobell777
ID: 10754230
<cfparam name="yourQueryName.yourBooleanValue" default="false" type="boolean">

<input type="checkbox" onClick="document.getElementById('myFile').disabled = (document.getElementById('myFile').disabled == false) ? true : false;" value="true"<cfif NOT yourQueryName.yourBooleanValue> checked</cfif>>
<input name="myFile" id="myFile" type="file"<cfif NOT yourQueryName.yourBooleanValue> disabled="true"</cfif>>
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 10754233
<cfparam name="yourQueryName.yourBooleanValue" default="false" type="boolean"> should really be a value from your database, a boolean value, i.e. 0/1 yes/no, true/false
0
 
LVL 17

Accepted Solution

by:
anandkp earned 143 total points
ID: 10755707
why u wanna make the file upload dependent on the checkbox ?
u cld just chk if the user has selected a file for upload or not - if he has upload it - else dont

with having checkbox - u'll see that user may select the file & if he unchecks the checkbox - the file will still get uploaded - leaving the element of "confusion".
u might go ahead & avoid all this & then later on u'll realise that "disabled" dosent work in "netscape" [i know not many users use it]. but u have a loop hole left in there for netscape users!

rest depends how u wanna set things for ur site.

K'Rgds
Anand
0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

Author Comment

by:chizzy60
ID: 11073916
everyone is way off... i want my points back!!
0
 
LVL 17

Assisted Solution

by:Tacobell777
Tacobell777 earned 142 total points
ID: 11073956
cool, then you should do
<cfif len(form.theNameOfTheFileUploadField)>
  do the upload........
</cfif>
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 11073961
Or you should explain what you are after in a different way, I think you threw everyone off with you mentioning the checkbox.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question