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

Unexplained Errors

New Here ,
Jun 23, 2009 Jun 23, 2009

I am building a form, and continue to get errors on new elements that are duplicate of elements already working in the form:

<html>
<head>
<title>CAF Survey Form</title>
</head>
<body bgcolor="#CCFFFF">
<h2 align="center">Enter a CAF Survey Form</h2><br>

<cfform action="surveyAction.cfm" method="post">

<table>
<tr>
<td width="33">
</td>
<td>

Date:
<cfinput type="text" name="SURVEY_DATE" size="10" maxlength="10">    

Branch:
<cfinput type="text" name="BRANCH" size="4" maxlength="4"><br><br><br>

1. Did you get what you needed today?                 
<cfinput type="radio" name="NEED_FLG" id="radio" value="Y">Yes
<cfinput type="radio" name="NEED_FLG" id="radio" value="N">No
<cfinput type="radio" name="NEED_FLG" id="radio" value="X">Did Not Answer<br><br>

If not, please explain:  
<cftextarea name="NEED_COMMENT" wrap="virtual" rows="5" cols="25"
validate="maxlength" validateAt="onBlur" maxlength="200" onKeyDown="limitText('comments','countdown_comments',200)">
</cftextarea><br><br>

2. Did you receive information about other community resources?                 
<cfinput type="radio" name="RESOURCE_FLG" id="radio" value="Y">Yes
<cfinput type="radio" name="RESOURCE_FLG" id="radio" value="N">No
<cfinput type="radio" name="RESOURCE_FLG" id="radio" value="X">Did Not Answer<br><br>

3. How long did you wait in the office to be seen today?   Minutes   Hours
   Did Not Answer<br>                                                                                       
<cfinput type="text" name="WAIT_MIN" size="2" maxlength="2">
<cfinput type="text" name="WAIT_HRS" size="2" maxlength="2">        
<cfinput type="checkbox" name="WAIT_FLG" value="X"><br><br>

4. How long did it take to get today's appointment??   Minutes   Hours
   Did Not Answer<br>                                                                                       
<cfinput type="text" name="APPT_HRS" size="2" maxlength="2">
<cfinput type="text" name="APPT_DAYS" size="2" maxlength="2">
<cfinput type="text" name="APPT_WEEKS" size="2" maxlength="2">        
<cfinput type="checkbox" name="APPT_FLG" value="X"><br><br>

<!--- 5. Did you have enough time during your appointment to <br>
   tell your case worker what you wanted or needed?         
<cfinput type="radio" name="TIME_FLG" id="radio" value="Y">Yes
<cfinput type="radio" name="TIME_FLG" id="radio" value="N">No
<cfinput type="radio" name="TIME_FLG" id="radio" value="X">Did Not Answer <br><br> --->

5. Did you have enough time during your appointment to <br>
   tell your case worker what you wanted or needed?         
<cfinput type="radio" name="TIME_FLG" id="radio" value="Y">Yes
<cfinput type="radio" name="TIME_FLG" id="radio" value="N">No
<cfinput type="radio" name="TIME_FLG" id="radio" value="X">Did Not Answer<br><br>

<!--- <cftextarea name="NEED_COMMENT" height="3" width="800" size="200" maxlength="200"></cftextarea> --->

<!--- <textarea name="Needcomments" cols="50" rows="3" id="Needcomments" tabindex="35" onFocus="this.rows=4" onBlur="this.rows=1" onSelect="this.rows=4" onKeyDown="limitText('comments','countdown_comments',200);" onKeyUp="limitText('comments','countdown_comments',200);"> </textarea> --->

<br><br><br>
<input type="Submit" value="Submit"> <input type="Reset"
value="Clear Form">

</td>
</table>

</cfform>

</body>
</html>
**************************************************

<html>
<head> <title>Insert Survey Form</title> </head>
<body>

<!--- Insert the new record --->

<cfset needCom = left(NEED_COMMENT,200)>

<cfif isdefined ("form.WAIT_FLG")>
<cfset form.WAIT_FLG = "X">
<cfelse>
<cfset form.WAIT_FLG = "N">
</cfif>

<cfif isdefined ("form.APPT_FLG")>
<cfset form.APPT_FLG = "X">
<cfelse>
<cfset form.APPT_FLG = "N">
</cfif>

<cfquery datasource="AXMISC_SURVEY">
   INSERT INTO SURVEY.CAF_SURVEY
   (SURVEY_DATE, BRANCH, NEED_FLG, NEED_COMMENT, RESOURCE_FLG, WAIT_MIN, WAIT_HRS, WAIT_FLG, APPT_HRS, APPT_DAYS, APPT_WEEKS, APPT_FLG, TIME_FLG)
   VALUES
   ( <cfqueryparam cfsqltype="cf_sql_date" value="#form.SURVEY_DATE#">,
     <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.BRANCH#">,
     <cfqueryparam cfsqltype="cf_sql_char" value="#form.NEED_FLG#">,
  <cfqueryparam cfsqltype="cf_sql_varchar"  value=#needCom#>,
  <cfqueryparam cfsqltype="cf_sql_char" value="#form.RESOURCE_FLG#">,
  <cfqueryparam cfsqltype="cf_sql_char" value="#form.WAIT_MIN#">,
  <cfqueryparam cfsqltype="cf_sql_char" value="#form.WAIT_HRS#">,
  <cfqueryparam cfsqltype="cf_sql_char" value="#form.WAIT_FLG#">,
  <cfqueryparam cfsqltype="cf_sql_char" value="#form.APPT_HRS#">,
  <cfqueryparam cfsqltype="cf_sql_char" value="#form.APPT_DAYS#">,
  <cfqueryparam cfsqltype="cf_sql_char" value="#form.APPT_WEEKS#">,
  <cfqueryparam cfsqltype="cf_sql_char" value="#form.APPT_FLG#">,
<cfqueryparam cfsqltype="cf_sql_char" value="#form.TIME_FLG#">
   )
</cfquery>

<!--- <cfoutput>You have added #CONTACT_NAME# to the
Client Survey database.
</cfoutput>   --->
</body>
</html>

*********************************************

Err Msg:

Error Executing Database Query.

[Macromedia][DB2 JDBC Driver]Value can not be converted to requested type.
The error occurred in C:\ColdFusion8\wwwroot\cafsurvey\surveyAction.cfm: line 37
35 :       <cfqueryparam cfsqltype="cf_sql_char" value="#form.APPT_WEEKS#">,
36 :       <cfqueryparam cfsqltype="cf_sql_char" value="#form.APPT_FLG#">,
37 :      <cfqueryparam cfsqltype="cf_sql_char" value="#form.TIME_FLG#">
38 :    )
39 : </cfquery>


#form.TIME_FLG# is set up identical to #form.NEED_FLG#.  I keep getting unexplained errors, and after putting the elements in and out and fiddling with the .cfm's eventually it works.  Any ideas as to why these errors come and go.  Is there a better way to do this?  I really need to get this done.

Thank you,

Jeanne

1.7K
Translate
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
New Here ,
Jun 23, 2009 Jun 23, 2009

I am noticing that when I do not fill in certain fields (that I want to have optional, I get error messages regarding not being able to convert one of the fields to a datatype.  The code is appearing to have issues with passing the fields.  Any ideas why this would be happening?  Is there a better way to do this?

Thanks,

Jeanne

Translate
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
Contributor ,
Jun 23, 2009 Jun 23, 2009

Hi,

Declare those optional variables

Please use the following for the option fields

eg:-<cfparam name="form.Name" default="">

Translate
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
New Here ,
Jun 24, 2009 Jun 24, 2009

When I do this, I get the following error message:

Attribute validation error for tag CFQUERYPARAM. 
The tag does not allow the attribute(s) DEFAULT. The valid attribute(s) are CFSQLTYPE,LIST,MAXLENGTH,NULL,SCALE,SEPARATOR,VALUE. 
 
The error occurred in C:\ColdFusion8\wwwroot\cafsurvey\surveyAction.cfm: line 29

27 :    (SURVEY_DATE, BRANCH, NEED_FLG, NEED_COMMENT, RESOURCE_FLG, WAIT_MIN, WAIT_HRS, WAIT_FLG, APPT_HRS, APPT_DAYS, APPT_WEEKS, APPT_FLG, TIME_FLG, TIME_COMMENT, ANSWERS_FLG, ANSWERS_COMMENT, SERVICE_FLG, SERVICE_COMMENT, OTHER_INFO, UNRESOLVED_FLG, CONTACT_NAME, CONTACT_PHONE)
28 :    VALUES
29 :    ( <cfqueryparam cfsqltype="cf_sql_date" value="#form.SURVEY_DATE#" default="No">,
30 :      <cfqueryparam cfsqltype="cf_sql_char" value="#form.BRANCH#">,
31 :      <cfqueryparam cfsqltype="cf_sql_char" value="#form.NEED_FLG#">,

Thank you,

Jeanne

Translate
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
New Here ,
Jun 24, 2009 Jun 24, 2009

Hi,

I wanted to validate on the client side, so that the user does not have to submit the form before getting the error message.

Thank you,

Jeanne

Translate
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
Contributor ,
Jun 24, 2009 Jun 24, 2009
LATEST

Please remove the "\default="No"\" from the cfqueryparam

<cfqueryparam cfsqltype="cf_sql_date" value="#form.SURVEY_DATE#" default="No">

Translate
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