Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Need to check file field for content in <cfinput type="file" name="custCartThumb">

Reply
Thread Tools

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

 
 
trint
Guest
Posts: n/a
 
      11-15-2006
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

 
Reply With Quote
 
 
 
 
Peter Michaux
Guest
Posts: n/a
 
      11-15-2006
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

 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      11-16-2006
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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
Copy File Field Value to Dynamic File Field Value VUNETdotUS Javascript 25 11-10-2007 10:36 AM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM
Need help with regular expression and form field check Tommy Javascript 4 09-21-2004 08:00 PM



Advertisments