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

Discussion in 'Javascript' started by trint, Nov 15, 2006.

  1. trint

    trint Guest

    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
    trint, Nov 15, 2006
    #1
    1. Advertising

  2. 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
    Peter Michaux, Nov 15, 2006
    #2
    1. Advertising

  3. trint

    Randy Webb Guest

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

    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/
    Randy Webb, Nov 16, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stanimir Stamenkov
    Replies:
    2
    Views:
    733
    Stanimir Stamenkov
    Oct 25, 2005
  2. Sergei Gnezdov

    type* name vs. type *name

    Sergei Gnezdov, Mar 29, 2005, in forum: C Programming
    Replies:
    5
    Views:
    277
    Gordon Burditt
    Mar 29, 2005
  3. John Davis
    Replies:
    2
    Views:
    373
    Dave Anderson
    Aug 18, 2003
  4. Pavils Jurjans
    Replies:
    3
    Views:
    169
    Pavils Jurjans
    Mar 18, 2005
  5. John
    Replies:
    4
    Views:
    91
Loading...

Share This Page