Solved

input type file prob

Posted on 2004-04-04
9
126 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
X-Frame-Options - click-jacking 7 46
Two nodes for updates and forwarding 8 46
ip / url redirect 13 57
Systems talking to each other 5 110
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now