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.