Copy link to clipboard
Copied
Hi again, ok i changed approaches form cfinsert to using a query. Since then I have not go the form to submit. OS Windows 7, CF8 and Access 2010 db
please see code:
action page::
<cfif not IsDefined("form.vendorTraining")>
<cfset form.vendorTraining ="NO">
</cfif>
<cfif not IsDefined("form.noAssist")>
<cfset form.noAssist ="NO">
</cfif>
<cfif not IsDefined("form.crabTraining")>
<cfset form.crabTraining ="NO">
</cfif>
<cfif not IsDefined("form.callMail")>
<cfset form.callMail ="NO">
</cfif>
<cfquery name="survey1" datasource="dsSurvey">
INSERT INTO designSoftwareSurvey
VALUES ('#form.contactPerson#',
'#form.jobPosition#',
'#form.contactEmail#',
'#form.county#',
'#form.civilUsed#',
#form.civilLicenses#,
'#form.civilSat#',
'#form.civilInterests#',
'#form.surveyUsed#',
#form.surveyLicenses#,
'#form.surveyDownload#',
'#form.surveyUpload#',
'#form.surveySat#',
'#form.surveyInterests#',
'#form.surveyProcess#',
'#form.cadUsed#',
#form.cadLicenses#,
'#form.cadSat#',
'#form.cadInterests#',
'#form.hydroUsed#',
#form.hydroLicenses#,
'#form.otherIssue#',
'#form.cost#',
'#form.training#',
'#form.hardware#',
'#form.agree#',
'#form.management#',
'#form.noAssist#'
'#form.callmail#',
'#form.crabTraining#',
'#form.vendorTraining#',
'#form.praise#',
'#form.cons#',
'#form.addComments#',
'#form.hydroInterests#' )
</cfquery>
<cfoutput>Thank you #form.contactName# for completing the Software survey.</cfoutput>
Error Executing Database Query. | ||||||
Syntax error (missing operator) in query expression ''yes' 'yes''. | ||||||
The error occurred in C:\Webroot\Crabweb1a\Technology\DesignSystems\softwareSurvey\confirmSurvey2.cfm: line 508 | ||||||
506 : '#form.cons#', 507 : '#form.addComments#', 508 : '#form.hydroInterests#' ) 509 : 510 : </cfquery> | ||||||
|
Copy link to clipboard
Copied
'yes' 'yes'
You are missing a comma in between two of the inserted values.
A good tip I have seen in these forums is to always place commas before the values. The formatting obviously has little impact on the sql. But personally I find it helps reduce "missing comma" errors and makes them easier to spot.
VALUES
(
'#firstValue#'
, '#secondValue#'
, '#thirdValue#'
, '#fourthValue#'
)
You might also take a look at using cfqueryparam.
Copy link to clipboard
Copied
Yes I was missing a comma, nice catch, I did not see it afer several checks. I am new to cfparam and I have not found a clear example when submitting forms on how to use.
How do I use it? Do I list cfparams for all of my fields at the top of the action page? OR just certain ones. for example how would you do a cfparam for a memo field.?
Copy link to clipboard
Copied
You might also use CFPARAM to provide default values.
Instead of:
<cfif not IsDefined("form.vendorTraining")>
<cfset form.vendorTraining ="NO">
</cfif>
You can use:
<cfparam name="form.vendorTraining" default="NO">