Solved

input type file prob

Posted on 2004-04-04
9
138 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
What You Need to Know when Searching for a Webhost Provider
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 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