Link to home
Start Free TrialLog in
Avatar of Rush_2112
Rush_2112

asked on

cf page ignoring cfparam?

I have a form on one page, which submits to a second page.

In the form, I have 5 text boxes, named hours1, hours2, hours3, hours4, hours5.

I have this at the top of the second page, to handle blank fields:

<cfparam name="form.hours1"default="0">
<cfparam name="form.hours2" default="0">
<cfparam name="form.hours3" default="0">
<cfparam name="form.hours4" default="0">
<cfparam name="form.hours5" default="0">

Here's my cfquery to insert:

<cfquery name="inserttimeoff" datasource="data">
INSERT INTO timeoff
(DateEntered,dayone,daytwo,daythree,dayfour,dayfive,comments,EmployeeID,ManagerID,hours1,hours2,hours3,hours4,hours5)
    VALUES (<cfqueryparam cfsqltype="cf_sql_date" value="#form.DateEntered#">,
    <cfqueryparam cfsqltype="cf_sql_date" value="#form.dayone#">,
    <cfqueryparam cfsqltype="cf_sql_date" value="#form.daytwo#">,
    <cfqueryparam cfsqltype="cf_sql_date" value="#form.daythree#">,
    <cfqueryparam cfsqltype="cf_sql_date" value="#form.dayfour#">,
    <cfqueryparam cfsqltype="cf_sql_date" value="#form.dayfive#">,
    <cfqueryparam cfsqltype="cf_sql_longvarchar" value="#form.comments#">,
    <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.EmployeeID#">,
    <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.ManagerID#">,
    <cfqueryparam value="#form.hours1#" cfsqltype="cf_sql_integer">,
        <cfqueryparam  value="#form.hours2#" cfsqltype="cf_sql_integer">,
            <cfqueryparam value="#form.hours3#" cfsqltype="cf_sql_integer">,
 <cfqueryparam  value="#form.hours4#" cfsqltype="cf_sql_integer">,
<cfqueryparam value="#form.hours5#" cfsqltype="cf_sql_integer">)
 </cfquery>

I get the following error:

Invalid data '' for CFSQLTYPE CF_SQL_INTEGER.  on line 32 which is:

32 : <cfqueryparam value="#form.hours5#" cfsqltype="cf_sql_integer">)

A CFdump shows this as the values of the hours1-hours5 fields:

HOURS1       8
HOURS2       [empty string]
HOURS3       [empty string]
HOURS4       [empty string]
HOURS5       [empty string]

(I typed in 8, left the rest blank)

So why that error?  Why is the code ignoring the parameters I set in the beginning of the second page?

Need help! Thanks
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
... lather, rinse, repeat for all of the hour fields.
Avatar of Rush_2112
Rush_2112

ASKER

yup, that did it!!  I forgot all about that... thanks!
perfect!