CFIF query using input of check box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ndeeley
    New Member
    • Mar 2007
    • 139

    CFIF query using input of check box

    Hi there,

    Having problems with a cfif query based on the value of a check box.

    I have an input type="file" field on a form. This allows the user to choose a file and upload the location to the database. Alas, I`m networked, and everyones drives are on different letters, so I need to strip out the first three characters and add them to the server & share.

    I can do this, but not in conjunction with a check box - basically saying that if this box if unchecked I don't want to complete the file location field.

    CF throws an error saying it can't strip characters from a null value. Can anyone take a look and tell me where I am going wrong?

    Checkbox is called 'form.Completed YN'
    Server Location drop down is called 'form.FileServe rFK'
    File browser box is called 'form.FileLoc'


    Code:
    <cfparam name="form.CompletedYN" default="0">
    
    insert into tblTaskBooker
    (FileLoc)
    values
    (<cfif #form.CompletedYN# EQ 0>
    No File Location Assigned
    <cfelse>
    <cfset FileLocation = '#form.FileServerFK#' & #RemoveChars('#form.FileLoc#',1,3)#>
    '#FileLocation#'
    </cfif>
    Thanks
    Neil
    Last edited by Niheel; Sep 22 '10, 07:19 PM. Reason: added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You need to put the text in quotes like you've done for FileLocation:
    Code:
     <cfif #form.CompletedYN# EQ 0>
    'No File Location Assigned'

    Comment

    • ndeeley
      New Member
      • Mar 2007
      • 139

      #3
      That's great, thanks acoder

      Comment

      Working...