• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Feb 03, 2008 Feb 03, 2008

Copy link to clipboard

Copied

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.

TOPICS
Advanced techniques

Views

258

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 03, 2008 Feb 03, 2008

Copy link to clipboard

Copied

LATEST
inputs have a value attribute you can use. you can discover your next problem when you submit the form without checking it.

for the text field, make it required and validate to integer or float if necessary. you'll have to change to cfinput to make that available though.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation