1 Reply Latest reply on Feb 3, 2008 12:11 PM by Dan Bracuk

    Getting an error "the argument passed to a function is not of type numeric from an input type=checkbox

    meeyaw
      Hi,

      I have an input type checkbox as shown:
      <input type="checkbox" id="compenPercent" name="compenPercent" <cfif rsAgreement.Percentage EQ 1>checked</cfif>>Percentage
      <input type="checkbox" id="compenlumpsum" name="compenlumpsum" <cfif rsAgreement.LumpSum EQ 1>checked</cfif>>Lump Sum

      The table fields which is used to store these values are declared as bit. I would like to have the value=1 when the user checks the box.

      In .cfc, these form fields are: I tried using type=Boolean also
      <cffunction name="createAgreement" access="remote" returntype="string" hint="Add agreement.>
      <cfargument name="IsCompenPercent" type="numeric" required="yes" default="0">
      <cfargument name="IsCompenLumpSum" type="numeric" required="yes" default="0">

      INSERT INTO Agreements
      (Percentage,
      LumpSum)
      VALUES
      (<cfqueryparam value="#arguments.IsCompenPercent#" cfsqltype="cf_sql_bit">,
      <cfqueryparam value="#arguments.IsCompenLumpSum#" cfsqltype="cf_sql_bit">)

      If I checked the box and save it, it gives an error:
      The argument INTPERCENTVALUE passed to function createAgreement() is not of type numeric.

      How do I passed a value 1 from a checbox input type?
      Also how do I handle a Null value from an input type=text and the field is integer. This seems to be a problem for integer but not on string. For strings, there is no problem if it's NULL.

      Thanks for any help.