Parameter index out of range

I get a Parameter index out of range error and I can’t find it back why. It is working in all my other pages just fine. Just in one page I can’t seem to find why I get this error.

I have update form. The name and description fields for two languages are created using a loop:


	<cfform method="post" preservedata="true">
  	<cfloop query="getProduct">
		<div class="form_wrapper">
			<label class="label medium_label">Product name (#getProduct.language_abbr#) <span>*</span></label>
		</div>    
		<div class="form_wrapper">
			<div class="input_bg input_bg_medium">
				<cfinput type="text" name="product_name_#ID#" class="input input_medium" message="Product name is required!" validateat="onBlur" required="yes" value="#getProduct.product_name#">      
			</div>
		</div>
		<div class="form_wrapper">
			<label class="label medium_label">Product Description (#getProduct.language_abbr#)</label>
		</div>
		<div class="form_wrapper">
 			<div class="text_bg">
      	<cftextarea name="product_description_#ID#" width="520" height="200"  >#getProduct.product_description#</cftextarea>   
    	</div>
    </div>     
    </cfloop>
  	<cfinput type="hidden" name="listofids" value="#ValueList( getProduct.ID )#">
		<div class="form_wrapper"> 
		<cfinput type="submit" name="submit_button" value="Submit" class="submit_button">
		</div>                    
	</cfform>

and this is the update query I’m using:


<cfloop index="id" list="#form.listofids#" delimiters=","> 
  <cfquery datasource="#Application.dsn#">
    UPDATE
          local_products
    SET
          product_name =  '#Evaluate( "Form.product_name_#id#" )#'
       ,	product_description = '#Evaluate( "Form.product_description_#id#" )#'
    WHERE
          ID IN ( <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim( id )#" list="true" /> )
  </cfquery>  
</cfloop>

I use the same method for updating two other tables with the same structure but only here I get this error. Does anyone see what I’m doing wrong.

I have one additional question about this. I don’t know if this is normal or if there is a way to avoid this, But I just found out after hours of testing and struggling that the error only appears with the text that the client have sent me (both english and greek). I saved it in a new notepad file etc but no matter what I try I keep getting that error. When I take any other text, no matter in what language everything is okay.

Is this something I can avoid? Or should I make adjustment in my table?

thank you in advance

first thing is:


WHERE ID IN ( <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim( id )#" list="true" /> )

Why would you have your id set as a varchar? Also, is CF trying to evaluate the ID in your where clause as a variable? I’d choose a better index for your loop. Another suggestion, drop the hidden field with your id’s, let the form field names act and your grouping mechanism and loop over them that way. Then you could drop the evaluate functions and instead refer to your fields with listGetAt().

my 2 cents.