Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 591317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:37:19+00:00 2026-05-13T15:37:19+00:00

A form field value like 45,234 is to be inserted into the DB as

  • 0

A form field value like 45,234 is to be inserted into the DB as 45234. When I try to do insert for 45,234, all it gets into the DB is 0.Note:- I am able to insert 45.234as 45.234 in the SQL DB.

The form field is named costOfShares, which is to be inserted into the table ShareVales (SQL Server 2005). I am using CF8.

SQL

table:-ShareVales; field:-costOfShares; DataType:-float

ColdFusion (form page)

<li>
  <cfinput size="8" maxlength="20" name="costOfShares" 
    id="costOfShares" value="#share.GetcostOfShares()#">
</li>

Share.cfc:-

<cfcomponent> 
    <cfscript> Variables.CostOfShare </cfscript> 
<cffunction name="GetCostOfShare" returntype="numeric" access="public" output="false">         
   <cfscript> variables.CostOfShare; </cfscript>
</cffunction>

<cffunction name="SetCostOfShare" retuntype="void" access="public" output="false">    
   <cfargument name="costOfShare" type="string"  required="true">
      <cfscript> variables. costOfShare = arguments. costOfShare; </cfscript>
  </cffunction>
</cfcomponent> 

ColdFusion (query page)

  <cffunction>
    <cfargumnet>
    <cfquery …>
      INSERT INTO ShareVales(shareUnitId, costOfShares) 
      VALUES (
        <cfqueryparam cfsqltype="cf_sql_integer"
                      value="#arguments.share.GetshareUnitId()#">,
        <cfqueryparam cfsqltype="cf_sql_float"
                      value="#arguments.share.GetcostOfShares()#">);
    </cfquery>
</cffunction>

When I use the following directly in the Query Editor:

INSERT into share(setCostOfShare)
values(Cast(replace('5,322,444',',','') as float))

it succeeds. The error is while using cfquery/cfqueryparam in the ColdFusion template.

So, how do insert the 45234 when the form field costOfShares contains a value with commas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:37:20+00:00Added an answer on May 13, 2026 at 3:37 pm

    If they type a comma, strip it out first before trying to insert.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a hidden form field, and when a button gets pressed the value
I want my form to have a field with a pre-fixed value like this:
I have a form field which requires a json object as its value when
I'm trying to get the value of a form field on submit using jQuery.
I have an hidden input field with a value, <form> <input type=hidden value=product/> <select
I need to set the value of a field in a form via JavaScript.
how do I set the value of a field element after a form has
I have this field in one form : <input type=text name=promocode id=promoCode value= style=width:24%
I am having trouble selecting a hidden form field value that is a part
I try to set some hidden form field values with an onclick event. Ok,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.