Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error when number fields in form are blank and submitted

Status
Not open for further replies.

olmos

Technical User
Oct 25, 2000
135
US
I am using cfquery to insert into certain columns of my table (using Oracle database). If the fields in the form are number fields and are left blank I get a missing expression error. Some fields are not required in the form but in order to not get an error I have to fill all of the number fields in the form. It works when some of the text fields are left blank. Anyone know what I am doing wrong and how do I fix this problem.

Thanks,
olmos
 
It sounds like your database is set to require values for the number fields. If you leave them blank, the insert will attempt to insert a null value into the number field. If the database field definition prohibits null values, you will get an error. In later versions of CF, you can modify form variables and you could do something like this.

<cfif form.var1 is &quot;&quot;>
<cfset form.var1 = 0>
</cfif>

If you don't want to insert 0 or some other number as the default, you will have to modify the database to allow null values.

Hope this helps,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top