2 Replies Latest reply on Jul 11, 2007 1:19 PM by lusciousmango

    Empty datefield not passing any parameter?

    lusciousmango
      I'm entering service calls (date requested (DateCalled), date performed (DateService), tech name, notes) into a db. I'm using the same form to edit existing calls or add new ones. I want the ability to add a record without submitting the date performed (so the user can edit that record with the data later).

      I've put in code that compares the two dates to make sure the date performed isn't before the date requested, and to make sure the date performed isn't in the future. All that works. When I try to add a condition to test for an empty string, I get a "Formal parameter '@TNotes' was defined as OUTPUT but the actual parameter not declared OUTPUT." error -- and the procedures all work FINE except in this one instance, so I don't want to change the stored procedures.

      This breaks both on new records, and if you edit an existing record to remove the DateService. It seems to me that the empty string isn't getting passed to the db at all, because I think that error indicates that my stored procedure is expecting more (or maybe fewer somehow) parameters than it got.

      Any insights or hints are welcomed. I'm attaching a pile of code. First section displays form to edit existing record/add new one. Second is the action page to edit/add the record. Last three bits are the stored procedures.

        • 1. Empty datefield not passing any parameter?
          cf_dev2 Level 1
          >> When I try to add a condition to test for an empty string, I get a "Formal parameter
          >> '@TNotes' was defined as OUTPUT but the actual parameter not declared OUTPUT." error

          Are you setting a default for date peformed when its an empty string?

          <cfif NOT IsDate(form.DateService)>
          <cfset form.DateService = (whatever default date you want)>
          </cfif>

          Or if its appropriate for your procedure, you could submit a NULL value instead of a default date
          <cfprocparam type="in" value="#form.DateService#" null="yes" ....>
          • 2. Re: Empty datefield not passing any parameter?
            lusciousmango Level 1
            cf_dev2, I kiss your feet.

            I put a CFIF in the middle of the CFSTOREDPROC to test for the empty string, and return a null if it's there; otherwise it passes the value.

            Thank you!