0 Replies Latest reply on Nov 13, 2006 7:13 AM by atsidi

    Verifying text field help

    atsidi
      I have two text fields that should contain a path to an image if if
      User clicks on
      "Add Image" button. One is for the Image and the other is for the
      Thumbnail.
      Problem:
      If User clicks on "Add Image" and either of the fields are empty, the
      page crashes
      and gives the message: file not found.
      I tried putting a javascript in, but it didn't recognize the cold fusion fields:
      function verify(){
      if(document.forms[0].#custCartFile#.value==""){
      alert("Please enter a Image in the field");
      return false;
      }else{
      return true;
      }
      if(document.forms[0].#custCartThumb#.value==""){
      alert("Please enter a Thumbnail in the field");
      return false;
      }else{
      return true;
      }
      }
      How can I verify the fields
      contain text or not?
      Here is my cf code:

      <cfinput type="submit" name="submit" value="Add Image">

      <td>
      <table align="center" border="0" >
      <tr><td>
      Image:
      </td>
      <td align="center">
      <div align="left">
      <cfinput type="file" name="custCartFile">
      </div></td></tr>
      <tr><td>
      Thumbnail:
      </td><td align="center">
      <div align="left">
      <cfinput type="file" name="custCartThumb">
      </div></td></tr>

      Thanks for any help.
      Trint