468,315 Members | 1,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,315 developers. It's quick & easy.

Need to check file field for content in <cfinput type="file" name="custCartThumb">

With the following code, I get the "message" whether or not there is
content in my filefield:

function check_file_field()
{
var file_field = document.getElementById("custCartFile");
if(file_field.value.length == 0)
{
alert("You are required to select an Image");
return false;
}
else
{
return true;
}
}

<cfinput type="file" name="custCartThumb">
<cfinput type="submit" name="submit" value="Add Image" onClick="return
check_file_field()">

It's like the function does not detect if the cfinput type="file"
contains anything!
Any help is appreciated.
Thanks,
Trint

Nov 15 '06 #1
2 2636
trint wrote:
<cfinput type="file" name="custCartThumb">
<cfinput type="submit" name="submit" value="Add Image" onClick="return
check_file_field()">

It's like the function does not detect if the cfinput type="file"
contains anything!
What is cfinput? It isn't an html tag.

http://www.w3schools.com/tags/default.asp

Peter

Nov 15 '06 #2
Peter Michaux said the following on 11/15/2006 3:09 PM:
trint wrote:
><cfinput type="file" name="custCartThumb">
<cfinput type="submit" name="submit" value="Add Image" onClick="return
check_file_field()">

It's like the function does not detect if the cfinput type="file"
contains anything!

What is cfinput? It isn't an html tag.

http://www.w3schools.com/tags/default.asp
It is Cold Fusion Server Side code.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by atse | last post: by
1 post views Thread by Monte Chan | last post: by
2 posts views Thread by Anne | last post: by
10 posts views Thread by Eddy | last post: by
reply views Thread by davesil2 | last post: by
6 posts views Thread by msuk | last post: by
4 posts views Thread by Tim::.. | last post: by
1 post views Thread by ADM - Dan | last post: by
6 posts views Thread by Mike Charney | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.